blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
3
276
src_encoding
stringclasses
33 values
length_bytes
int64
23
9.61M
score
float64
2.52
5.28
int_score
int64
3
5
detected_licenses
listlengths
0
44
license_type
stringclasses
2 values
text
stringlengths
23
9.43M
download_success
bool
1 class
b4fb9ea933ff289c1823528d6fe2276835e37e7b
SQL
wallacevncs/LibraryGUI
/script/libraryScript.sql
UTF-8
489
2.96875
3
[ "MIT", "curl" ]
permissive
create database library; CREATE TABLE library.user( id int AUTO_INCREMENT, name varchar(100) NOT NULL, cpf varchar(11) NOT NULL, dateOfBirth varchar(10) NOT NULL, numberOfPhone varchar(11) NOT NULL, address varchar(100) NOT NULL, historic json, PRIMARY KEY (id) ); CREATE TABLE library.book( id int AUTO_INCREMENT, bookCode varchar(10) NOT NULL, titleBook varchar(100) NOT NULL, category varchar(50) NOT NULL, quantity int NOT NULL, loans int NOT NULL, historic json, PRIMARY KEY (id) );
true
0527376c1663dfa53e1c6f3afd96c5b287acee93
SQL
techgeeker/obsolete
/online-shopping-demo/src/main/resources/sql/table_order.sql
UTF-8
3,156
4.0625
4
[]
no_license
SET NAMES utf8; DROP TABLE IF EXISTS `tb_product`; CREATE TABLE `tb_product` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `prod_name` VARCHAR(20) NOT NULL DEFAULT '', `model` VARCHAR(50) NOT NULL DEFAULT '', `prod_type` TINYINT(4) NOT NULL DEFAULT 0 COMMENT '0 no type, or other specific types', `prod_image_url` VARCHAR(200) NOT NULL DEFAULT '', `price` INT(10) NOT NULL DEFAULT -1 COMMENT 'unit: cent', `balance` INT(10) NOT NULL DEFAULT -1 COMMENT 'stock balance', `sales_volume` INT(10) NOT NULL DEFAULT 0 COMMENT 'number of copies sold out', `comment_count` INT(10) NOT NULL DEFAULT 0 COMMENT 'number of comments', `collect_count` INT(10) NOT NULL DEFAULT 0 COMMENT 'number of customers collecting the product', `popularity` INT(10) NOT NULL DEFAULT 0 COMMENT 'index of popularity of the product', `status` TINYINT(2) NOT NULL DEFAULT -1 COMMENT '1 on sale, 2 no stock, 3 off stock', `create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), KEY `idx_prod_type` (`prod_type`), KEY `idx_price` (`price`), KEY `idx_sales_volume` (`sales_volume`), KEY `idx_update_time` (`update_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='product entity'; DROP TABLE IF EXISTS `tb_order`; CREATE TABLE `tb_order` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `customer_id` BIGINT(20) NOT NULL DEFAULT -1 COMMENT 'foreign key reference tb_customer.id', `address_id` BIGINT(20) NOT NULL DEFAULT -1 COMMENT 'foreign key reference tb_address.id', `total_price` INT(10) NOT NULL DEFAULT -1 COMMENT 'unit: cent', `prod_count` INT(10) NOT NULL DEFAULT 0 COMMENT 'number of products in the order', `status` TINYINT(2) NOT NULL DEFAULT 1 COMMENT '1 not paid, 2 paid, 3 delivered, 4 received, 5 canceled', `create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), FOREIGN KEY `fk_customer_id` (`customer_id`) REFERENCES tb_customer(`id`), FOREIGN KEY `fk_address_id` (`address_id`) REFERENCES tb_address(`id`), KEY `idx_customer_id` (`customer_id`), KEY `idx_address_id` (`address_id`), KEY `idx_create_time` (`create_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='order entity'; DROP TABLE IF EXISTS `tb_order_product`; CREATE TABLE `tb_order_product` ( `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'primary key', `order_id` BIGINT(20) NOT NULL DEFAULT -1 COMMENT 'foreign key reference tb_order.id', `product_id` BIGINT(20) NOT NULL DEFAULT -1 COMMENT 'foreign key reference tb_product.id', `prod_count` INT(10) NOT NULL DEFAULT 0 COMMENT 'number of products in the order', `create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`), FOREIGN KEY `fk_order_id` (`order_id`) REFERENCES tb_order(`id`), FOREIGN KEY `fk_product_id` (`product_id`) REFERENCES tb_product(`id`), KEY `idx_create_time` (`create_time`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='relation between order and product';
true
8978f8851d45077bfca2f6c957d06b485f1dcad7
SQL
aleagustin/pillsbox-server
/database.sql.sql
UTF-8
5,062
3.125
3
[]
no_license
create database pillsbox; CREATE TABLE usuarios ( id serial, email varchar(100) NOT NULL, contrasena varchar(64) NOT NULL, nombre varchar(20) NOT NULL, apellido varchar(20) NOT NULL, fecha_nacimiento date NOT NULL, notificaciones boolean NOT NULL DEFAULT false, PRIMARY KEY (id), UNIQUE (email) ); CREATE TABLE pillsbox ( id serial, usuario_id integer NOT NULL, nombre varchar(20) NOT NULL, fecha_creacion date NOT NULL, PRIMARY KEY (id), UNIQUE (usuario_id, nombre), CONSTRAINT pillsbox_ibfk_1 FOREIGN KEY (usuario_id) REFERENCES usuarios (id) ON DELETE CASCADE ON UPDATE CASCADE ); CREATE TABLE medicacion ( id serial, cn varchar(8) NOT NULL, nombre_comercial varchar(200) NOT NULL, principio_activo varchar(100) NOT NULL, PRIMARY KEY (id), UNIQUE (cn) ); CREATE TABLE pillsbox_medicacion ( id serial, pillsbox_id integer NOT NULL, medicacion_id integer NOT NULL, fecha_creacion date NOT NULL, fecha_inicio date NOT NULL, fecha_fin date DEFAULT NULL, PRIMARY KEY (id), UNIQUE (pillsbox_id, medicacion_id), CONSTRAINT pillsbox_medicacion_ibfk_1 FOREIGN KEY (medicacion_id) REFERENCES medicacion (id) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT pillsbox_medicacion_ibfk_2 FOREIGN KEY (pillsbox_id) REFERENCES pillsbox (id) ON DELETE CASCADE ON UPDATE CASCADE ); CREATE TABLE horario_medicacion ( id serial, pillsboxmedicacion_id integer NOT NULL, hora time NOT NULL, lunes boolean NOT NULL DEFAULT false, martes boolean NOT NULL DEFAULT false, miercoles boolean NOT NULL DEFAULT false, jueves boolean NOT NULL DEFAULT false, viernes boolean NOT NULL DEFAULT false, sabado boolean NOT NULL DEFAULT false, domingo boolean NOT NULL DEFAULT false, PRIMARY KEY (id), UNIQUE (pillsboxmedicacion_id, hora), CONSTRAINT horario_medicacion_ibfk_1 FOREIGN KEY (pillsboxmedicacion_id) REFERENCES pillsbox_medicacion (id) ON DELETE CASCADE ON UPDATE CASCADE ); INSERT INTO usuarios (email, contrasena, nombre, apellido, fecha_nacimiento) VALUES('alejandromaruottolo@gmail.com', '99800b85d3383e3a2fb45eb7d0066a4879a9dad0', 'Alejandro', 'Maruottolo', '1990-01-01'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox1', '2020-04-01'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox2', '2020-04-02'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox3', '2020-04-03'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox4', '2020-04-04'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox5', '2020-04-05'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox6', '2020-04-06'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox7', '2020-04-07'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox8', '2020-04-08'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox9', '2020-04-09'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox10', '2020-04-10'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox11', '2020-04-11'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox12', '2020-04-12'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox13', '2020-04-13'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox14', '2020-04-14'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox15', '2020-04-15'); INSERT INTO pillsbox (usuario_id, nombre, fecha_creacion) VALUES (1, 'Pillbox16', '2020-04-16'); INSERT INTO medicacion (cn, nombre_comercial, principio_activo ) VALUES ('62802', 'AMOXICILINA/ACIDO CLAVULANICO SANDOZ 500 mg/125 mg COMPRIMIDOS RECUBIERTOS CON PELICULA EFG', 'AMOXICILINA TRIHIDRATO, CLAVULANATO POTASIO'); INSERT INTO medicacion (cn, nombre_comercial, principio_activo ) VALUES ('723798', 'ADIRO 100 MG COMPRIMIDOS GASTRORRESISTENTES EFG', 'ACETILSALICILICO ACIDO'); INSERT INTO pillsbox_medicacion (pillsbox_id, medicacion_id, fecha_creacion, fecha_inicio, fecha_fin) VALUES (16, 1, '2020-04-11', '2020-04-11', '2020-04-18'); INSERT INTO pillsbox_medicacion (pillsbox_id, medicacion_id, fecha_creacion, fecha_inicio) VALUES (16, 2, '2020-04-11', '2020-04-11'); INSERT INTO horario_medicacion (pillsboxmedicacion_id, hora, lunes, martes, miercoles, jueves, viernes, sabado, domingo) VALUES (1, '08:00', true, true, true, true, true, true, true); INSERT INTO horario_medicacion (pillsboxmedicacion_id, hora, lunes, martes, miercoles, jueves, viernes, sabado, domingo) VALUES (1, '16:00', true, true, true, true, true, true, true); INSERT INTO horario_medicacion (pillsboxmedicacion_id, hora, lunes, martes, miercoles, jueves, viernes, sabado, domingo) VALUES (1, '00:00', true, true, true, true, true, true, true); INSERT INTO horario_medicacion (pillsboxmedicacion_id, hora, lunes, martes, miercoles, jueves, viernes, sabado, domingo) VALUES (2, '08:00', true, true, true, true, true, true, true);
true
a1380f800d0ab72f0df351c94d7f42dc8b2529a3
SQL
GabrielVargasR/University-DB1-Auto-Parts-Shop
/src/sql_scripts/create/InsertOrganizacion.sql
UTF-8
745
3.515625
4
[]
no_license
DELIMITER // DROP PROCEDURE IF EXISTS InsertOrganizacion// CREATE PROCEDURE InsertOrganizacion ( IN pCedula DECIMAL(10, 0), IN pTelefono DECIMAL(8,0), IN pNombreContacto VARCHAR(40), IN pTelefonoContacto DECIMAL(8,0), IN pCargoContacto VARCHAR(25), IN pIdCliente INT ) BEGIN DECLARE cont DECIMAL(8, 0); SELECT c.telefono INTO cont FROM contacto as c WHERE c.telefono = pTelefonoContacto; IF (cont IS NULL) THEN CALL InsertContacto(pNombreContacto, pTelefonoContacto, pCargoContacto); END IF; INSERT INTO organizacion(cedula, id_cliente, tel_contacto) VALUES (pCedula, pIdCliente, pTelefonoContacto); CALL InsertTelOrganizacion(pCedula, pTelefono); END // DELIMITER ;
true
d45ea4ad65f08fe2e411677075002e98c6ba4f53
SQL
anirudhr/CS6083-DB
/as2/cus-5mov.sql
UTF-8
270
3.265625
3
[]
no_license
USE videoRentalChain; SELECT balance, cid FROM customer WHERE cid IN ( SELECT cid FROM rented WHERE outdate >= (SELECT DATE_SUB(curdate(), INTERVAL 2 WEEK)) GROUP BY cid HAVING COUNT(cid) >= 5 )
true
8a0fd5211f7d46aa5868cd387bf658650351cf1a
SQL
N05TR4/Sistema_Universitario
/bd_universidad.sql
UTF-8
1,487
3.796875
4
[]
no_license
create database bd_universidad; use bd_universidad; create table login( Usuario varchar(30) not null, Contraseña varchar(30) not null, fecha TIMESTAMP ) select * from login; create table Estudiante( nombre varchar(50) not null, apellido varchar(50) not null, direccion varchar(100) not null, fecha_nacimiento varchar(100) not null, telefono varchar(20) not null, matricula varchar(50) not null, carrera varchar(50) not null, primary key(matricula) )engine=InnoDB; create table carrera( nombre varchar(50) not null, primary key(nombre) ); alter table Estudiante add foreign key(carrera) references carrera(nombre); create table materia( nombre varchar(50) not null, horario varchar(50) not null, profesor varchar(50) not null, estudiante varchar(50) not null, primary key(nombre) ); create table seccion( seccion varchar(20) not null, primary key(seccion) ); create table profesor( nombre varchar(50) not null, apellido varchar(50) not null, direccion varchar(100) not null, fecha_nacimiento varchar(100) not null, telefono varchar(20) not null, seccion varchar(20) not null, materia varchar(50) not null, primary key(nombre) ); alter table materia add foreign key(profesor) references profesor(nombre); alter table materia add foreign key(estudiante) references Estudiante(matricula); alter table profesor add foreign key(seccion) references seccion(seccion); select *from carrera; select *from Estudiante; select *from profesor; select *from seccion; select *from materia;
true
f12cbc92c95b35dfcdcad77110cb55c8f3b731c5
SQL
dseng905/newstyper-app
/server/database/create_database.sql
UTF-8
930
3.3125
3
[]
no_license
CREATE DATABASE newstyper; CREATE TABLE user_profiles( id SERIAL PRIMARY KEY, email VARCHAR(255) UNIQUE, password VARCHAR(255), first_name VARCHAR(255), last_name VARCHAR(255) ); CREATE TABLE article_typing_results( id SERIAL PRIMARY KEY, user_id SERIAL REFERENCES user_profiles(id), article_id TEXT, wpm INT, time_completed INT, completed_at DATE NOT NULL DEFAULT CURRENT_DATE ); CREATE TABLE saved_articles( id SERIAL PRIMARY KEY, user_id SERIAL REFERENCES user_profiles(id), article_id TEXT ); CREATE TABLE user_statistics( id SERIAL PRIMARY KEY, user_id SERIAL REFERENCES user_profiles(id) UNIQUE, average_wpm INT, total_articles_completed INT, daily_goal INT, daily_goal_articles_completed INT ); CREATE TABLE user_settings( id SERIAL PRIMARY KEY, user_id SERIAL REFERENCES user_profiles(id) UNIQUE, daily_goal INT DEFAULT 3, );
true
0b09395810a018085946913a02fb4180b951c135
SQL
ManuelPalomares/pruebaSophosNodeJsGimnasio
/ScriptBd/DML.sql
UTF-8
2,180
3.421875
3
[]
no_license
/* drop table `prueba_sophos`.`sedes_usuarios`; drop table `prueba_sophos`.`sedes`; drop table `prueba_sophos`.`ciudades`; drop table `prueba_sophos`.`usuarios`;*/ CREATE TABLE IF NOT EXISTS `prueba_sophos`.`usuarios` ( `id` INT NOT NULL AUTO_INCREMENT, `login` VARCHAR(45) NULL, `nombre` VARCHAR(45) NOT NULL, `password` VARCHAR(500) NOT NULL, `email` VARCHAR(45) NOT NULL, `role` VARCHAR(45) NOT NULL, `createdAt` VARCHAR(45) NULL, `updatedAt` VARCHAR(45) NULL, PRIMARY KEY (`id`), UNIQUE INDEX `login_UNIQUE` (`login` ASC) VISIBLE) ENGINE = MyISAM; CREATE TABLE IF NOT EXISTS `prueba_sophos`.`ciudades` ( `id` INT NOT NULL AUTO_INCREMENT, `descripcion` VARCHAR(45) NULL, `createdAt` VARCHAR(45) NULL, `updatedAt` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = MyISAM; CREATE TABLE IF NOT EXISTS `prueba_sophos`.`sedes` ( `id` INT NOT NULL AUTO_INCREMENT, `idciudad` INT NULL, `descripcion` VARCHAR(45) NOT NULL, `capacidadmax` INT NOT NULL DEFAULT 300 COMMENT 'capacidad maxima de la sede .', `createdAt` VARCHAR(45) NULL, `updatedAt` VARCHAR(45) NULL, PRIMARY KEY (`id`), INDEX `fk_idciudad_idx` (`idciudad` ASC) VISIBLE, CONSTRAINT `fk_idciudad` FOREIGN KEY (`idciudad`) REFERENCES `prueba_sophos`.`ciudades` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = MyISAM; CREATE TABLE IF NOT EXISTS `prueba_sophos`.`sedes_usuarios` ( `id` INT NOT NULL AUTO_INCREMENT, `id_sede` INT NOT NULL, `id_usuario` INT NOT NULL, `createdAt` VARCHAR(45) NULL, `updatedAt` VARCHAR(45) NULL, PRIMARY KEY (`id`), INDEX `fk_id_usuario_idx` (`id_usuario` ASC) VISIBLE, INDEX `fk_id_sede_idx` (`id_sede` ASC) VISIBLE, CONSTRAINT `fk_id_usuario` FOREIGN KEY (`id_usuario`) REFERENCES `prueba_sophos`.`usuarios` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_id_sede` FOREIGN KEY (`id_sede`) REFERENCES `prueba_sophos`.`sedes` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = MyISAM; -- insert usuario admin insert into usuarios (login,nombre,password,email,role) values('admin','admin','$2a$10$SMtE7yjy1DDnBrzzitjNqeAV513XQOKCm7avSzGdemn2XTt28Z1k.','admin@admin.com','USR_ADM'); commit;
true
65505bb1dc4c014d830a366297264b56ccee891b
SQL
rootPan/Hospital
/hospital.sql
UTF-8
21,913
3.015625
3
[]
no_license
/* Navicat MySQL Data Transfer Source Server : . Source Server Version : 50717 Source Host : 127.0.0.1:3306 Source Database : hospital Target Server Type : MYSQL Target Server Version : 50717 File Encoding : 65001 Date: 2017-04-23 14:18:05 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for appointment -- ---------------------------- DROP TABLE IF EXISTS `appointment`; CREATE TABLE `appointment` ( `aid` int(11) NOT NULL AUTO_INCREMENT, `uid` int(11) DEFAULT NULL, `patientname` varchar(20) DEFAULT NULL, `mid` int(11) DEFAULT NULL, `visittime` varchar(100) DEFAULT NULL, `visitseq` int(11) DEFAULT NULL, PRIMARY KEY (`aid`) ) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of appointment -- ---------------------------- INSERT INTO `appointment` VALUES ('1', '2', '2', '4', '2016-04-20 星期三下午', '1'); INSERT INTO `appointment` VALUES ('2', '3', '3', '4', '2016-04-20 星期三下午', '2'); INSERT INTO `appointment` VALUES ('3', '1', '1', '4', '2016-04-20 星期三下午', '3'); INSERT INTO `appointment` VALUES ('4', '8', '8', '4', '2016-04-20 星期三下午', '4'); INSERT INTO `appointment` VALUES ('5', '4', '4', '4', '2016-04-20 星期三下午', '5'); INSERT INTO `appointment` VALUES ('6', '5', '5', '4', '2016-04-20 星期三下午', '6'); INSERT INTO `appointment` VALUES ('7', '6', '6', '4', '2016-04-20 星期三下午', '7'); INSERT INTO `appointment` VALUES ('8', '7', '7', '4', '2016-04-20 星期三下午', '8'); INSERT INTO `appointment` VALUES ('9', '12', '12', '4', '2016-04-20 星期三下午', '9'); INSERT INTO `appointment` VALUES ('10', '13', '13', '4', '2016-04-20 星期三下午', '10'); INSERT INTO `appointment` VALUES ('16', '18', '18', '2', '2016-04-25 星期一下午', '1'); INSERT INTO `appointment` VALUES ('17', '1', '1', '2', '2016-04-25 星期一下午', '2'); INSERT INTO `appointment` VALUES ('18', '2', '2', '2', '2016-04-25 星期一下午', '3'); INSERT INTO `appointment` VALUES ('19', '3', '3', '2', '2016-04-25 星期一下午', '4'); INSERT INTO `appointment` VALUES ('20', '4', '4', '2', '2016-04-25 星期一下午', '5'); INSERT INTO `appointment` VALUES ('21', '8', '8', '2', '2016-04-25 星期一下午', '6'); INSERT INTO `appointment` VALUES ('22', '7', '20', '2', '2016-04-25 星期一下午', '7'); INSERT INTO `appointment` VALUES ('23', '6', '6', '2', '2016-04-25 星期一下午', '8'); INSERT INTO `appointment` VALUES ('24', '5', '5', '2', '2016-04-25 星期一下午', '9'); INSERT INTO `appointment` VALUES ('25', '9', '9', '2', '2016-04-25 星期一下午', '10'); INSERT INTO `appointment` VALUES ('26', '10', '10', '2', '2016-04-25 星期一下午', '11'); INSERT INTO `appointment` VALUES ('27', '13', '13', '2', '2016-04-25 星期一下午', '12'); INSERT INTO `appointment` VALUES ('28', '12', '12', '2', '2016-04-25 星期一下午', '13'); INSERT INTO `appointment` VALUES ('29', '11', '11', '2', '2016-04-25 星期一下午', '14'); INSERT INTO `appointment` VALUES ('30', '14', '14', '2', '2016-04-25 星期一下午', '15'); INSERT INTO `appointment` VALUES ('31', '15', '15', '2', '2016-04-25 星期一下午', '16'); INSERT INTO `appointment` VALUES ('32', '16', '16', '2', '2016-04-25 星期一下午', '17'); INSERT INTO `appointment` VALUES ('33', '17', '17', '2', '2016-04-25 星期一下午', '18'); INSERT INTO `appointment` VALUES ('34', '5', '5', '4', '2016-04-22 星期五上午', '1'); INSERT INTO `appointment` VALUES ('35', '1', '1', '4', '2016-04-22 星期五上午', '2'); INSERT INTO `appointment` VALUES ('36', '2', '2', '4', '2016-04-22 星期五上午', '3'); INSERT INTO `appointment` VALUES ('37', '4', '4', '4', '2016-04-22 星期五上午', '4'); INSERT INTO `appointment` VALUES ('38', '3', '3', '4', '2016-04-22 星期五上午', '5'); INSERT INTO `appointment` VALUES ('39', '6', '6', '4', '2016-04-22 星期五上午', '6'); INSERT INTO `appointment` VALUES ('40', '7', '7', '4', '2016-04-22 星期五上午', '7'); INSERT INTO `appointment` VALUES ('41', '11', '11', '4', '2016-04-22 星期五上午', '8'); INSERT INTO `appointment` VALUES ('42', '17', '12', '4', '2016-04-22 星期五上午', '9'); INSERT INTO `appointment` VALUES ('43', '8', '8', '4', '2016-04-22 星期五上午', '10'); INSERT INTO `appointment` VALUES ('44', '9', '9', '4', '2016-04-22 星期五上午', '11'); INSERT INTO `appointment` VALUES ('45', '10', '10', '4', '2016-04-22 星期五上午', '12'); INSERT INTO `appointment` VALUES ('47', '13', '13', '4', '2016-04-22 星期五上午', '14'); INSERT INTO `appointment` VALUES ('54', '9', '9', '4', '2016-04-20 星期三下午', '11'); INSERT INTO `appointment` VALUES ('55', '10', '21', '4', '2016-04-20 星期三下午', '12'); INSERT INTO `appointment` VALUES ('56', '22', '22', '4', '2016-04-20 星期三下午', '13'); INSERT INTO `appointment` VALUES ('57', '23', '23', '4', '2016-04-20 星期三下午', '14'); INSERT INTO `appointment` VALUES ('59', '24', '24', '4', '2016-04-20 星期三下午', '15'); INSERT INTO `appointment` VALUES ('60', '1', '1', '1', '2017-04-20 星期四上午', '19'); INSERT INTO `appointment` VALUES ('61', '1', '1', '1', '2017-04-27 星期四上午', '19'); INSERT INTO `appointment` VALUES ('62', '1', '1', '1', '2017-04-27 星期四上午', '19'); -- ---------------------------- -- Table structure for dept -- ---------------------------- DROP TABLE IF EXISTS `dept`; CREATE TABLE `dept` ( `did` int(11) NOT NULL AUTO_INCREMENT, `dname` varchar(50) NOT NULL, `dspec` varchar(500) DEFAULT NULL, `pdid` int(11) DEFAULT NULL, PRIMARY KEY (`did`), UNIQUE KEY `d_name` (`dname`), KEY `p_did` (`pdid`), CONSTRAINT `dept_ibfk_1` FOREIGN KEY (`pdid`) REFERENCES `dept` (`did`) ) ENGINE=InnoDB AUTO_INCREMENT=80 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of dept -- ---------------------------- INSERT INTO `dept` VALUES ('1', '内科', null, null); INSERT INTO `dept` VALUES ('2', '外科', null, null); INSERT INTO `dept` VALUES ('3', '儿科', null, null); INSERT INTO `dept` VALUES ('4', '口腔科', null, null); INSERT INTO `dept` VALUES ('5', '眼科', null, null); INSERT INTO `dept` VALUES ('6', '骨科', null, null); INSERT INTO `dept` VALUES ('7', '妇产科', null, null); INSERT INTO `dept` VALUES ('8', '心血管内科', null, '1'); INSERT INTO `dept` VALUES ('9', '神经内科', '主要诊治脑血管疾病(脑梗塞、脑出血)、偏头痛、脑部炎症性疾病(脑炎、脑膜炎)、脊髓炎、癫痫、痴呆、神经系统变性病、代谢病和遗传病、三叉神经痛、坐骨神经病、周围神经病(四肢麻木、无力)及重症肌无力等', '1'); INSERT INTO `dept` VALUES ('10', '内分泌科', null, '1'); INSERT INTO `dept` VALUES ('11', '呼吸内科', null, '1'); INSERT INTO `dept` VALUES ('12', '消化内科', null, '1'); INSERT INTO `dept` VALUES ('13', '肾脏内科', '肾内科是各级医院为了诊疗肾脏病而设置的一个临床科室。常见的肾脏替代治疗方式有肾移植、血液透析和腹膜透析', '1'); INSERT INTO `dept` VALUES ('14', '风湿免疫科', null, '1'); INSERT INTO `dept` VALUES ('15', '血液科', null, '1'); INSERT INTO `dept` VALUES ('16', '感染科', null, '1'); INSERT INTO `dept` VALUES ('17', '肝病科', null, '1'); INSERT INTO `dept` VALUES ('18', '泌尿外科', null, '2'); INSERT INTO `dept` VALUES ('19', '神经外科', null, '2'); INSERT INTO `dept` VALUES ('20', '心脏外科', null, '2'); INSERT INTO `dept` VALUES ('21', '胸外科', null, '2'); INSERT INTO `dept` VALUES ('22', '胃外科', null, '2'); INSERT INTO `dept` VALUES ('23', '肠外科', null, '2'); INSERT INTO `dept` VALUES ('24', '肝外科', null, '2'); INSERT INTO `dept` VALUES ('25', '胆外科', null, '2'); INSERT INTO `dept` VALUES ('26', '血管外科', null, '2'); INSERT INTO `dept` VALUES ('27', '外伤科', null, '2'); INSERT INTO `dept` VALUES ('28', '烧伤科', null, '2'); INSERT INTO `dept` VALUES ('29', '小儿消化科', null, '3'); INSERT INTO `dept` VALUES ('30', '小儿呼吸科', '儿童哮喘、婴儿喘息、反复呼吸道感染、慢性咳嗽、肺炎等疑难杂症', '3'); INSERT INTO `dept` VALUES ('31', '小儿皮肤科', '主要治疗幼儿、儿童的各种皮肤病,常见皮肤病有牛皮癣 、 疱疹 、酒渣鼻 、脓疱疮等', '3'); INSERT INTO `dept` VALUES ('32', '儿童保健科', null, '3'); INSERT INTO `dept` VALUES ('33', '新生儿科', null, '3'); INSERT INTO `dept` VALUES ('34', '小儿骨科', null, '3'); INSERT INTO `dept` VALUES ('35', '小儿心血管内科', null, '3'); INSERT INTO `dept` VALUES ('36', '小儿免疫科', null, '3'); INSERT INTO `dept` VALUES ('37', '小儿肾内科', null, '3'); INSERT INTO `dept` VALUES ('38', '小儿血液科', null, '3'); INSERT INTO `dept` VALUES ('39', '小儿内分泌科', null, '3'); INSERT INTO `dept` VALUES ('40', '小儿外科', null, '3'); INSERT INTO `dept` VALUES ('41', '小儿心外科', null, '3'); INSERT INTO `dept` VALUES ('42', '小儿胸外科', null, '3'); INSERT INTO `dept` VALUES ('43', '小儿神经外科', null, '3'); INSERT INTO `dept` VALUES ('44', '小儿泌尿科', null, '3'); INSERT INTO `dept` VALUES ('45', '小儿遗传病科', null, '3'); INSERT INTO `dept` VALUES ('46', '小儿耳鼻喉科', null, '3'); INSERT INTO `dept` VALUES ('47', '口腔修复科', null, '4'); INSERT INTO `dept` VALUES ('48', '正畸科', null, '4'); INSERT INTO `dept` VALUES ('49', '牙体牙髓科', null, '4'); INSERT INTO `dept` VALUES ('50', '牙周科', null, '4'); INSERT INTO `dept` VALUES ('51', '种植科', null, '4'); INSERT INTO `dept` VALUES ('52', '口腔粘膜科', '口腔粘膜科是治疗粘膜病的专业科室,主要从事口腔粘膜病的治疗', '4'); INSERT INTO `dept` VALUES ('53', '口腔预防科', null, '4'); INSERT INTO `dept` VALUES ('54', '儿童口腔科', null, '4'); INSERT INTO `dept` VALUES ('55', '眼视光学科', null, '5'); INSERT INTO `dept` VALUES ('56', '眼外伤科', null, '5'); INSERT INTO `dept` VALUES ('57', '眼底科', null, '5'); INSERT INTO `dept` VALUES ('58', '白内障科', null, '5'); INSERT INTO `dept` VALUES ('59', '角膜科', null, '5'); INSERT INTO `dept` VALUES ('60', '青光眼科', null, '5'); INSERT INTO `dept` VALUES ('61', '眼整形科', null, '5'); INSERT INTO `dept` VALUES ('62', '小儿眼科', null, '5'); INSERT INTO `dept` VALUES ('63', '骨关节科', null, '6'); INSERT INTO `dept` VALUES ('64', '脊柱外科', '专门诊治脊柱骨折、创伤、颈椎病、腰椎间盘突出症、脊柱肿瘤、颈、腰人工椎间盘置换、脊柱翻修等', '6'); INSERT INTO `dept` VALUES ('65', '足踝外科', null, '6'); INSERT INTO `dept` VALUES ('66', '创伤外科', null, '6'); INSERT INTO `dept` VALUES ('67', '运动医学科', null, '6'); INSERT INTO `dept` VALUES ('68', '矫形骨科', null, '6'); INSERT INTO `dept` VALUES ('69', '妇科', null, '7'); INSERT INTO `dept` VALUES ('70', '产科', null, '7'); INSERT INTO `dept` VALUES ('71', '产前诊断科', null, '7'); INSERT INTO `dept` VALUES ('72', '计划生育科', null, '7'); INSERT INTO `dept` VALUES ('73', '妇泌尿科', null, '7'); INSERT INTO `dept` VALUES ('74', '妇科内分泌', null, '7'); INSERT INTO `dept` VALUES ('75', '遗传科', null, '7'); INSERT INTO `dept` VALUES ('76', '过敏反应科', null, '1'); INSERT INTO `dept` VALUES ('77', '老年病科', null, '1'); INSERT INTO `dept` VALUES ('78', '肿瘤科', null, null); INSERT INTO `dept` VALUES ('79', '肿瘤内科', null, '78'); -- ---------------------------- -- Table structure for hospital -- ---------------------------- DROP TABLE IF EXISTS `hospital`; CREATE TABLE `hospital` ( `hid` int(11) NOT NULL AUTO_INCREMENT, `hname` varchar(50) NOT NULL, `address` varchar(50) DEFAULT NULL, `grade` varchar(50) DEFAULT NULL, PRIMARY KEY (`hid`), UNIQUE KEY `h_name` (`hname`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of hospital -- ---------------------------- INSERT INTO `hospital` VALUES ('1', '武汉同济医院', '武汉市解放大道1095号', '三甲'); INSERT INTO `hospital` VALUES ('2', '武汉协和医院', '武汉市解放大道1277', '三甲'); INSERT INTO `hospital` VALUES ('3', '湖北省人民医院', '武汉市张之洞路95', '三甲'); INSERT INTO `hospital` VALUES ('4', '武汉市第一医院', '武汉市中山大道215号', '三甲'); INSERT INTO `hospital` VALUES ('5', '武汉市第四医院', '武汉市汉正街472号', '三甲'); INSERT INTO `hospital` VALUES ('6', '武汉市第六医院', '武汉市香港路80号', '三乙'); INSERT INTO `hospital` VALUES ('7', '武汉市第九医院', '武汉市吉林街20号', '二级'); INSERT INTO `hospital` VALUES ('8', '武汉市商业职工医院', '武汉市大兴路13号', '二级'); -- ---------------------------- -- Table structure for mediciner -- ---------------------------- DROP TABLE IF EXISTS `mediciner`; CREATE TABLE `mediciner` ( `mid` int(11) NOT NULL AUTO_INCREMENT, `mname` varchar(20) NOT NULL, `title` varchar(20) DEFAULT NULL, `mspec` varchar(500) DEFAULT NULL, `surgeryweekday` varchar(100) DEFAULT NULL, `limitvisits` varchar(20) DEFAULT NULL, `hospital` varchar(20) DEFAULT NULL, `dept` varchar(20) DEFAULT NULL, PRIMARY KEY (`mid`), KEY `hospital` (`hospital`), KEY `dept` (`dept`), CONSTRAINT `mediciner_ibfk_1` FOREIGN KEY (`hospital`) REFERENCES `hospital` (`hname`), CONSTRAINT `mediciner_ibfk_2` FOREIGN KEY (`dept`) REFERENCES `dept` (`dname`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of mediciner -- ---------------------------- INSERT INTO `mediciner` VALUES ('1', '蔡红国', '主任医师', null, '星期二上午,星期二下午,星期四上午', '18', '武汉协和医院', '小儿呼吸科'); INSERT INTO `mediciner` VALUES ('2', '陈乾坤', '副主任医师', null, '星期一下午,星期三上午,星期三下午', '18', '武汉市第一医院', '消化内科'); INSERT INTO `mediciner` VALUES ('3', '陈诗云', '主任医师', null, '星期三上午,星期四上午', '15', '湖北省人民医院', '小儿皮肤科'); INSERT INTO `mediciner` VALUES ('4', '曹磊军', '主任医师', null, '星期三上午,星期三下午,星期五上午', '15', '武汉同济医院', '口腔粘膜科'); INSERT INTO `mediciner` VALUES ('5', '崔敬娴', '副主任医师', null, '星期三下午,星期四上午', '18', '武汉市第四医院', '骨关节科'); INSERT INTO `mediciner` VALUES ('6', '邓红娟', '主任医师', null, '星期一上午,星期三上午,星期五下午', '16', '武汉同济医院', '脊柱外科'); INSERT INTO `mediciner` VALUES ('7', '邓金余', '副主任医师', null, '星期三上午,星期三下午,星期五上午', '18', '湖北省人民医院', '泌尿外科'); INSERT INTO `mediciner` VALUES ('8', '方新章', '主任医师', null, '星期二下午,星期四上午', '15', '武汉协和医院', '肾脏内科'); INSERT INTO `mediciner` VALUES ('9', '董琴怡', '主任医师', null, '星期三下午,星期四上午,星期四下午', '18', '武汉同济医院', '小儿皮肤科'); INSERT INTO `mediciner` VALUES ('11', '张兆辉', '付主任医师', null, '星期一上午,星期二上午', '15', '武汉同济医院', '神经内科'); -- ---------------------------- -- Table structure for user -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( `uid` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) NOT NULL, `pwd` varchar(50) NOT NULL, `uname` varchar(50) NOT NULL, `gender` varchar(50) NOT NULL, `identity` varchar(50) DEFAULT NULL, `mobile` varchar(50) DEFAULT NULL, PRIMARY KEY (`uid`) ) ENGINE=InnoDB AUTO_INCREMENT=63 DEFAULT CHARSET=utf8; -- ---------------------------- -- Records of user -- ---------------------------- INSERT INTO `user` VALUES ('1', 'zhang1m', '123', '张一男', '男', '42010419780210****', '15927092***'); INSERT INTO `user` VALUES ('2', 'zhang2m', '123', '张二男', '男', '42020119690112****', '1381212****'); INSERT INTO `user` VALUES ('3', 'zhang3m', '123', '张三男', '男', '42010419821012****', '1369898****'); INSERT INTO `user` VALUES ('4', 'zhang4m', '123', '张四男', '男', null, null); INSERT INTO `user` VALUES ('5', 'zhang5m', '123', '张五男', '男', null, null); INSERT INTO `user` VALUES ('6', 'zhang6m', '123', '张六男', '男', null, null); INSERT INTO `user` VALUES ('7', 'zhang7m', '123', '张七男', '男', null, null); INSERT INTO `user` VALUES ('8', 'zhang8m', '123', '张八男', '男', null, null); INSERT INTO `user` VALUES ('9', 'zhang9m', '123', '张九男', '男', null, null); INSERT INTO `user` VALUES ('10', 'zhang0m', '123', '张零男', '男', null, null); INSERT INTO `user` VALUES ('11', 'zhang0f', '123', '张零女', '女', null, null); INSERT INTO `user` VALUES ('12', 'zhang1f', '123', '张一女', '女', null, null); INSERT INTO `user` VALUES ('13', 'zhang2f', '123', '张二女', '女', null, null); INSERT INTO `user` VALUES ('14', 'zhang3f', '123', '张三女', '女', null, null); INSERT INTO `user` VALUES ('15', 'zhang4f', '123', '张四女', '女', null, null); INSERT INTO `user` VALUES ('16', 'zhang5f', '123', '张五女', '女', null, null); INSERT INTO `user` VALUES ('17', 'zhang6f', '123', '张六女', '女', null, null); INSERT INTO `user` VALUES ('18', 'zhang7f', '123', '张七女', '女', null, null); INSERT INTO `user` VALUES ('19', 'zhang8f', '123', '张八女', '女', null, null); INSERT INTO `user` VALUES ('20', 'zhang9f', '123', '张九女', '女', null, null); INSERT INTO `user` VALUES ('21', 'li0f', '123', '李零女', '女', null, null); INSERT INTO `user` VALUES ('22', 'li1f', '123', '李一女', '女', null, null); INSERT INTO `user` VALUES ('23', 'li2f', '123', '李二女', '女', null, null); INSERT INTO `user` VALUES ('24', 'li3f', '123', '李三女', '女', null, null); INSERT INTO `user` VALUES ('25', 'li4f', '123', '李四女', '女', null, null); INSERT INTO `user` VALUES ('26', 'li5f', '123', '李五女', '女', null, null); INSERT INTO `user` VALUES ('27', 'li6f', '123', '李六女', '女', null, null); INSERT INTO `user` VALUES ('28', 'li7f', '123', '李七女', '女', null, null); INSERT INTO `user` VALUES ('29', 'li8f', '123', '李八女', '女', null, null); INSERT INTO `user` VALUES ('30', 'li9f', '123', '李九女', '女', null, null); INSERT INTO `user` VALUES ('31', 'li0m', '123', '李零男', '男', null, null); INSERT INTO `user` VALUES ('32', 'li1m', '123', '李一男', '男', null, null); INSERT INTO `user` VALUES ('33', 'li2m', '123', '李二男', '男', null, null); INSERT INTO `user` VALUES ('34', 'li3m', '123', '李三男', '男', null, null); INSERT INTO `user` VALUES ('35', 'li4m', '123', '李四男', '男', null, null); INSERT INTO `user` VALUES ('36', 'li5m', '123', '李五男', '男', null, null); INSERT INTO `user` VALUES ('37', 'li6m', '123', '李六男', '男', null, null); INSERT INTO `user` VALUES ('38', 'li7m', '123', '李七男', '男', null, null); INSERT INTO `user` VALUES ('39', 'li8m', '123', '李八男', '男', null, null); INSERT INTO `user` VALUES ('40', 'li9m', '123', '李九男', '男', null, null); INSERT INTO `user` VALUES ('41', 'wang0m', '123', '王零男', '男', null, null); INSERT INTO `user` VALUES ('42', 'wang1m', '123', '王一男', '男', null, null); INSERT INTO `user` VALUES ('43', 'wang2m', '123', '王二男', '男', null, null); INSERT INTO `user` VALUES ('44', 'wang3m', '123', '王三男', '男', null, null); INSERT INTO `user` VALUES ('45', 'wang4m', '123', '王四男', '男', null, null); INSERT INTO `user` VALUES ('46', 'wang5m', '123', '王五男', '男', null, null); INSERT INTO `user` VALUES ('47', 'wang6m', '123', '王六男', '男', null, null); INSERT INTO `user` VALUES ('48', 'wang7m', '123', '王七男', '男', null, null); INSERT INTO `user` VALUES ('49', 'wang8m', '123', '王八男', '男', null, null); INSERT INTO `user` VALUES ('50', 'wang9m', '123', '王九男', '男', null, null); INSERT INTO `user` VALUES ('51', 'wang0f', '123', '王零女', '女', null, null); INSERT INTO `user` VALUES ('52', 'wang1f', '123', '王一女', '女', null, null); INSERT INTO `user` VALUES ('53', 'wang2f', '123', '王二女', '女', null, null); INSERT INTO `user` VALUES ('54', 'wang3f', '123', '王三女', '女', null, null); INSERT INTO `user` VALUES ('55', 'wang4f', '123', '王四女', '女', null, null); INSERT INTO `user` VALUES ('56', 'wang5f', '123', '王五女', '女', null, null); INSERT INTO `user` VALUES ('57', 'wang6f', '123', '王六女', '女', null, null); INSERT INTO `user` VALUES ('58', 'wang7f', '123', '王七女', '女', null, null); INSERT INTO `user` VALUES ('59', 'wang8f', '123', '王八女', '女', null, null); INSERT INTO `user` VALUES ('60', 'wang9f', '123', '王九女', '女', null, null); INSERT INTO `user` VALUES ('61', 'zhao1m', '123', '赵一男', '男', null, null); INSERT INTO `user` VALUES ('62', 'zhangmeng1', '123', '我啊', '男', null, null); -- ---------------------------- -- Procedure structure for pro_set -- ---------------------------- DROP PROCEDURE IF EXISTS `pro_set`; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `pro_set`( _uid int, _mid int, _visittime VARCHAR(100), out flag int ) BEGIN DECLARE count int; DECLARE _limitvisits int; SELECT limitvisits INTO _limitvisits from mediciner where mid=_mid; SELECT count(*) INTO count from appointment where mid=4 and visittime='2016-04-20 星期三下午'; IF(count+1>_limitvisits) THEN set flag = 0; ELSE INSERT appointment values(NULL,_uid,_uid,_mid,_visittime,_limitvisits+1); set flag = 1; END IF; END ;; DELIMITER ;
true
7edcca91d8fb06858b20cde8c5fb4a551f3823ab
SQL
freitmi/queries-vldb2020
/graph/queries/1.sql
UTF-8
151
2.734375
3
[]
no_license
SELECT COUNT(*) FROM edges e1, edges e2, edges e3 WHERE e1.sink = e3.source AND e1.source = e2.source AND e2.sink = e3.sink;
true
b77821a231739df7a038fbba7962e62fbdab3c00
SQL
PedroFreitas90/Sakila-NoSQL
/Oracle/constraints.sql
UTF-8
2,437
3.203125
3
[ "MIT" ]
permissive
ALTER TABLE city ADD CONSTRAINT fk_city_country FOREIGN KEY (country_id) REFERENCES country(country_id); ALTER TABLE address ADD CONSTRAINT fk_address_city FOREIGN KEY (city_id) REFERENCES city(city_id); ALTER TABLE staff ADD CONSTRAINT fk_staff_address FOREIGN KEY (address_id) REFERENCES address (address_id); ALTER TABLE store ADD CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id); ALTER TABLE store ADD CONSTRAINT fk_store_address FOREIGN KEY (address_id) REFERENCES address (address_id); ALTER TABLE staff ADD CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id); ALTER TABLE customer ADD CONSTRAINT fk_customer_address FOREIGN KEY (address_id) REFERENCES address (address_id); ALTER TABLE customer ADD CONSTRAINT fk_customer_store FOREIGN KEY (store_id) REFERENCES store (store_id); ALTER TABLE film ADD CONSTRAINT fk_film_language FOREIGN KEY (language_id) REFERENCES language (language_id); ALTER TABLE film ADD CONSTRAINT fk_film_language_original FOREIGN KEY (original_language_id) REFERENCES language (language_id); ALTER TABLE film_actor ADD CONSTRAINT fk_film_actor_actor FOREIGN KEY (actor_id) REFERENCES actor (actor_id); ALTER TABLE film_actor ADD CONSTRAINT fk_film_actor_film FOREIGN KEY (film_id) REFERENCES film (film_id); ALTER TABLE film_category ADD CONSTRAINT fk_film_category_film FOREIGN KEY (film_id) REFERENCES film (film_id); ALTER TABLE film_category ADD CONSTRAINT fk_film_category_category FOREIGN KEY (category_id) REFERENCES category (category_id); ALTER TABLE inventory ADD CONSTRAINT fk_inventory_store FOREIGN KEY (store_id) REFERENCES store (store_id); ALTER TABLE inventory ADD CONSTRAINT fk_inventory_film FOREIGN KEY (film_id) REFERENCES film (film_id); ALTER TABLE rental ADD CONSTRAINT fk_rental_staff FOREIGN KEY (staff_id) REFERENCES staff (staff_id); ALTER TABLE rental ADD CONSTRAINT fk_rental_inventory FOREIGN KEY (inventory_id) REFERENCES inventory (inventory_id); ALTER TABLE rental ADD CONSTRAINT fk_rental_customer FOREIGN KEY (customer_id) REFERENCES customer (customer_id); ALTER TABLE payment ADD CONSTRAINT fk_payment_rental FOREIGN KEY (rental_id) REFERENCES rental (rental_id); ALTER TABLE payment ADD CONSTRAINT fk_payment_customer FOREIGN KEY (customer_id) REFERENCES customer (customer_id); ALTER TABLE payment ADD CONSTRAINT fk_payment_staff FOREIGN KEY (staff_id) REFERENCES staff (staff_id);
true
1d9ab4fa99f18f22c9695572a4af7237a29ac0f9
SQL
chanrychhoy/project1_php
/database/project_programing.sql
UTF-8
12,197
3.234375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.1.1 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Aug 22, 2021 at 07:42 PM -- Server version: 10.4.20-MariaDB -- PHP Version: 8.0.9 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 NAMES utf8mb4 */; -- -- Database: `project_programing` -- -- -------------------------------------------------------- -- -- Table structure for table `category` -- CREATE TABLE `category` ( `cate_id` int(11) NOT NULL, `cate_name` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `category` -- INSERT INTO `category` (`cate_id`, `cate_name`) VALUES (1, 'php'), (2, 'Vuejs'); -- -------------------------------------------------------- -- -- Table structure for table `lesson` -- CREATE TABLE `lesson` ( `lesson_id` int(11) NOT NULL, `title` varchar(200) NOT NULL, `img` varchar(200) NOT NULL, `description` varchar(1000) NOT NULL, `date` datetime NOT NULL DEFAULT current_timestamp(), `cate_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `lesson` -- INSERT INTO `lesson` (`lesson_id`, `title`, `img`, `description`, `date`, `cate_id`) VALUES (85, 'Introduction to Vue', 'php-6121baca994829.87502501.jpg', 'The start of a brand new tutorial series about Vue.js 2.0! We will start learning the fundamentals and then move onto more advanced stuff. In this video I introduce the series and explain the organization of the next few lessons.We will start by learning the basics. Afterwards we will build some Vue.js apps that rely on no other framework (other than Html & CSS). Finally we will build a full scale app that relies on a backend built in Laravel. However it can easily be adapted to any framework as it will follow general CRUD principles.', '2021-08-22 09:47:18', 2), (86, 'Vue.js Project Setup ', 'php-6121bb8eb02385.30066211.jpg', 'Learn how to setup a Vue.js 2.0 project in this tutorial. It is actually incredibly simple! All we have to do is load the Vuejs script from a CDN (or locally), then initialize it with one line of code.You will love how simple it is to get up and running.', '2021-08-22 09:49:58', 2), (87, 'Directives in Vue.js ', 'vue-6121bc0fb905f0.76063863.jpg', 'Tutorial covering Directives in Vue.js 2.0. Directives are like mini-functions that we add to html elements to “boost” them with extra functionality. These are common functions that we tend to find ourselves re-writing every time we make a new website. For example binding values of inputs to variables, tying events to html elements, hiding elements until they load and much more.We can replicate this functionality using easy directives. All directives are prefixed with a “v-“ and are attached directly to HTML elements.In this video we cover the basic directives, while saving the more commonly used directives to their own respective text.', '2021-08-22 09:53:03', 2), (88, 'Using V-Bind Directive ', 'php-6121beb795c621.31303899.jpg', 'This Vue.js tutorial covers the use of V-bind attach data models to our view attributes. This is an easy and helpful way to take our Vue data models and attach them to attributes on html elements with the same power of binding that you see with everything else in Vue.The concepts are actually extremely simple, we attach v-bind: followed by the attribute you want to change and then set it equal to the data model you want it to equal.v-bind:title=“message” v-bind:src=“imageURL” v-bind:alt=“message” ', '2021-08-22 09:55:29', 2), (89, 'Looping with V-For', 'php-6121bd4e77d2c3.92877743.jpg', 'Tutorial covering the v-for directive allowing us to create loops in our html elements. This is great for making lists, or looping through resources for a truly dynamic experience.The v-for directive requires an array or object to loop through. Each iteration of the loop will have access to a loop object and access to each parameter of that current iterated object.', '2021-08-22 09:57:25', 2), (90, '2-Way Binding with V-Model ', 'vue-6121bdc8db1542.33451589.jpg', 'This Vue.js tutorial covers 2 way binding in Vue.js and what it means for our applications. Actually putting 2 way binding to use it very simple because it happens automatically, so we will spend the majority of this episode discussing why it is powerful and how you can use it.', '2021-08-22 10:00:24', 2), (91, 'Event Handling ', 'php-61225bae745f36.69580631.jpg', 'Vue.js 2.0 Tutorial demonstrating how to use events in Vue. You might be familiar with events already if you from any other javascript background or framework. Events are things like Hover or Click that happen when your application is running. In Vue.js we can tie various methods in when these events occur. This allows us further customization over what happens and how a user interacts with the application. Vue.js events can be designated with the v-event directive or with a simple @ sign before the event name. Coming Up: Computer Properties in Vue.js ==== LINKS ==== Vue.JS API on V-Bind https://vuejs.org/v2/api/#v-model ==== DOWNLOAD SOURCE CODE ==== Download from GitHub: https://github.com/DevMarketer/VueJS_... ==== MORE FROM THIS SERIES . ==== Previous Video [Part 6]: https://youtu.be/nEdsu6heW9o Next video [Part 8]: Coming Soon Full Playlist for the ', '2021-08-22 10:02:03', 2), (94, 'Introduction to PHP', 'php-6121c10d460839.28425248.png', 'PHP is also known as Hypertext Pre-processor. PHP is an open-source and server-side scripting language, which is mainly used for developing web applications. The syntax of the PHP language is similar to the C language. PHP was originally created by Rasmus Lerdorf, and it first appeared in 1995. PHP is widely used in developing web applications and has become one of the major languages for the developers to create new applications.', '2021-08-22 10:14:21', 1), (95, 'Introduction of PHP Keywords', 'php-6121c1e5aed686.83231922.png', 'Keywords are the words hold some meaning. In regular use of PHP language, these words cannot be used as a constant, a variable name, a method name, a class name, etc. ', '2021-08-22 10:17:57', 1), (96, 'Introduction to Advantages of PHP', 'php-6121c24fb71fe8.92277146.jpg', 'PHP is known as the general purpose programming language. It is used as a server-side scripting language that is mainly used for the development of web sites. The PHP frameworks also make web development easier. This framework helps in reusing the same code and there is no need to write the lengthy and complex code for the web applications.', '2021-08-22 10:19:43', 1), (97, 'Definition of PHP Global Variable', 'php-6121c2997d0715.00138653.jpg', 'In any programming language, global variables are those variable which are declared outside the method or functions, also they can be declared inside of the functions as well. Global variable is just like any other variable but the difference is that this scope is global in application. If we make any variable global then we can access that variable from our whole application which means inside or outside of the script as well. Global variable functions the same way everywhere, as the name, suggests they are global for other resources. In the coming section, we will discuss more this PHP Global Variable in detail.', '2021-08-22 10:20:57', 1), (98, 'Definition of Local Variable in PHP', 'php-6121c2efb50302.48219645.jpg', 'Local variables are those variables that are declared inside the function of a Php program and have their scope inside that function only. Local variables have no scope outside the function (variable cannot be referenced outside the function), so cannot be used outside its scope in the program. If any other variable with the same name is used in a program outside a function(a global variable), it is considered differently and has its own identity, and considered as a completely different variable. ', '2021-08-22 10:22:23', 1), (99, 'Introduction to PHP Commands', 'php-6121c343514611.59816015.jpg', 'PHP stands for hypertext processor which are designed as a server-side scripting language for developing the web application. The PHP code is mainly combined or embedded with HTML syntax, but it can be used for any template system of the web application or available web framework.', '2021-08-22 10:23:47', 1), (100, 'Introduction to PHP Loops', 'php-6122478503eef1.44002228.jpg', 'PHP Loops are a type of code which can help us to run some code inside of the loop to run over and over again according to our requirement as the input and these loops will help run the code and complete the task infinitely as we want in order to execute the same code inside of the loop again and again until our condition becomes false or else the code runs continuously. The word itself says that it is going to be repeated but only if a certain condition is true which is mentioned in the loop parameters to check the condition for the PHP loop/loops.', '2021-08-22 10:25:18', 1), (101, 'Introduction to For Loop in PHP', 'php-6121c41170fe03.38629491.png', 'Loops in PHP are used to perform a task repeatedly. For Loop in PHP has various forms. For loop loops a number of times like any other loop ex. while loop. While loop and for loop executes a block of code, which is based on a condition. When it is known beforehand that a particular block of code should execute this number of times say 5 times we use for loop. ', '2021-08-22 10:27:13', 1), (102, 'PHP Do While Loop', 'php-6122448f6f7117.88231824.png', 'A server-side scripting language, PHP is a very popular and widely used open-source language. Initially, PHP was known as –Personal Home Page. In this topic, we are going to learn about PHP Do While Loop.', '2021-08-22 10:29:21', 1), (113, 'v-bind', 'php-61226ccaa7c9c5.41750232.png', 'you will know how to use v-bind(1)', '2021-08-22 21:12:44', 2), (122, 'upload image', 'php-61226496e9e6e5.36280784.jpg', 'how to set condition validation in php.', '2021-08-22 21:52:06', 1), (123, 'upload image', 'php-6122650763f797.61162174.jpg', 'how to upload image ', '2021-08-22 21:53:59', 1); -- -------------------------------------------------------- -- -- Table structure for table `user` -- CREATE TABLE `user` ( `user_id` int(11) NOT NULL, `user_name` varchar(100) NOT NULL, `profile` varchar(400) NOT NULL, `email` varchar(200) NOT NULL, `password` varchar(50) NOT NULL, `userType` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `user` -- INSERT INTO `user` (`user_id`, `user_name`, `profile`, `email`, `password`, `userType`) VALUES (9, 'NOLY', 'profile-6121c77c690586.32199633.png', 'noly@gmail.com', '456', 'user'), (11, 'NONA', 'profile-6121c804b31520.25672534.jpg', 'nona@gmail.com', '123', 'Admin'); -- -- Indexes for dumped tables -- -- -- Indexes for table `category` -- ALTER TABLE `category` ADD PRIMARY KEY (`cate_id`); -- -- Indexes for table `lesson` -- ALTER TABLE `lesson` ADD PRIMARY KEY (`lesson_id`), ADD KEY `cate_id` (`cate_id`); -- -- Indexes for table `user` -- ALTER TABLE `user` ADD PRIMARY KEY (`user_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `category` -- ALTER TABLE `category` MODIFY `cate_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `lesson` -- ALTER TABLE `lesson` MODIFY `lesson_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=138; -- -- AUTO_INCREMENT for table `user` -- ALTER TABLE `user` MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12; -- -- Constraints for dumped tables -- -- -- Constraints for table `lesson` -- ALTER TABLE `lesson` ADD CONSTRAINT `cate_id` FOREIGN KEY (`cate_id`) REFERENCES `category` (`cate_id`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
9305ad6bb3b7de2c98bfc6b87acf4740a8c86337
SQL
Lucaskp96/Peoplegrid
/_documentacao/tabelasPeopleGrid/resposta.sql
UTF-8
1,080
3.375
3
[]
no_license
-- Table: peoplegrid.resposta -- DROP TABLE peoplegrid.resposta; CREATE TABLE peoplegrid.resposta ( id serial NOT NULL, codnivelescolaridade serial NOT NULL, codrendafamiliar serial NOT NULL, codvocepensoucomo serial NOT NULL, codquestionario serial NOT NULL, CONSTRAINT pk_resposta PRIMARY KEY (id), CONSTRAINT fk_codquestionario FOREIGN KEY (codquestionario) REFERENCES peoplegrid.questionario (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk_nivelescolaridade FOREIGN KEY (codnivelescolaridade) REFERENCES peoplegrid.nivelescolaridade (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk_rendafamiliar FOREIGN KEY (codrendafamiliar) REFERENCES peoplegrid.rendafamiliar (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION, CONSTRAINT fk_vocepensoucomo FOREIGN KEY (codvocepensoucomo) REFERENCES peoplegrid.vocepensoucomo (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ) WITH ( OIDS=FALSE ); ALTER TABLE peoplegrid.resposta OWNER TO postgres;
true
cd352dcb8f5a5b36258490280520a51813db3aeb
SQL
chenlixinpeng/test
/db/damai.sql
UTF-8
8,046
2.765625
3
[]
no_license
SET NAMES UTF8; CREATE DATABASE damai CHARSET=UTF8; USE damai; CREATE TABLE dm_product( pid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, title VARCHAR(128) NOT NULL, detail VARCHAR(128) DEFAULT NULL, showTime VARCHAR(128) NOT NUll, city VARCHAR(128) NOT NULL, venues VARCHAR(128) NOT NULL, classify VARCHAR(128) NOT NULL, price VARCHAR(128) DEFAULT '100', more1 VARCHAR(128) DEFAULT NULL, more2 VARCHAR(128) DEFAULT NULL ); INSERT INTO dm_product VALUES(null,'《市场街最后一站》','向前奔驰不停歇,只为相伴你一路成长','2018.06.23','北京','京演民族宫大剧院','kids亲子','80',null,null); INSERT INTO dm_product VALUES(null,'开心麻花合家欢音乐剧《三只小羊》第16轮','一则挪威家喻户晓的经典寓言故事','2018.03.31','北京','A33剧场','kids亲子','100',null,null); INSERT INTO dm_product VALUES(null,'快乐农场大冒险','img/kids/detail/kids03_detail.jpg','2018.3','全国','全国','kids亲子','88',null,null); INSERT INTO dm_product VALUES(null,'亚历山大与汪星人','乌克兰努尔马戏剧院萌宠滑稽幽默剧 《亚历山大与汪星人》','2018.2.2','唐山','唐山大剧院大剧场','kids亲子','85',null,null); INSERT INTO dm_product VALUES(null,'《猫鼠大战闹新春》','儿童剧《猫鼠大战闹新春》','2018.0.03','合肥','合肥大剧院多功能厅','kids亲子','90',null,null); INSERT INTO dm_product VALUES(null,'《圆梦恐龙岛》','大型原创冒险式儿童舞台剧《圆梦恐龙岛》','2018.02.04 19:30','唐山','唐山大剧院大剧场','kids亲子','98',null,null); INSERT INTO dm_product VALUES(null,'《绿野仙踪》','大型奇幻互动式儿童舞台剧《绿野仙踪》','2018.02.05','无锡','宜兴保利大剧院','kids亲子','128',null,null); INSERT INTO dm_product VALUES(null,'《莫扎特很忙》','交响音乐儿童剧《莫扎特很忙》','2018.02.07','上海','黄浦剧场-中剧场','kids亲子','65',null,null); INSERT INTO dm_product VALUES(null,'《看我72变》','辰星剧社原创近景即兴魔幻儿童剧《看我72变》','2017.12.30-02.11','北京','正华星博剧场','kids亲子','100',null,null); INSERT INTO dm_product VALUES(null,'《灰姑娘》','彩色熊猫·祼眼3D全息儿童剧《灰姑娘》','2018.01.05-02.24','成都','彩色熊猫剧场','kids亲子','88',null,null); INSERT INTO dm_product VALUES(null,'《哪吒》','中国杂技团新编大型杂技神话剧《哪吒》','2017.12.02-2018.02.11','北京','中国儿童中心剧院','kids亲子','60',null,null); INSERT INTO dm_product VALUES(null,'《三只小猪》','彩色熊猫·祼眼3D全息儿童剧《三只小猪》','2017.12.03—2018.02.25','成都','彩色熊猫剧场','kids亲子','75',null,null); INSERT INTO dm_product VALUES(null,'《三只小猪》','彩色熊猫·祼眼3D全息儿童剧《三只小猪》','2017.12.03—2018.02.25','成都','彩色熊猫剧场','kids亲子','99',null,null); INSERT INTO dm_product VALUES(null,'《格尔达的奇幻冒险》','全息版 冰雪奇缘—《格尔达的奇幻冒险》','2018.02.01-2018.02.15','广州','正佳演艺剧院','kids亲子','100',null,null); INSERT INTO dm_product VALUES(null,'久石让宫崎骏经典视听音乐会','天空之城—久石让宫崎骏经典视听音乐会 ','2018.02-14-2018.02-15','上海','上海大剧院-别克中剧场','kids亲子','100',null,null); INSERT INTO dm_product VALUES(null,'《亚历山大与汪星人》','华艺星空·乌克兰萌宠滑稽幽默剧《亚历山大与汪星人》 ','2018.02.16-02.18','北京','北京剧院','kids亲子','95',null,null); INSERT INTO dm_product VALUES(null,'《天鹅湖》','华艺星空.乌克兰基辅儿童芭蕾舞团《天鹅湖》','2018.02.10-02.18','上海','艺海剧院','kids亲子','88',null,null); INSERT INTO dm_product VALUES(null,'2018新春版朝阳公园大马戏','2018新春版朝阳公园大马戏','2018.02.16-02.21','北京','朝阳公园西4门08广场','kids亲子','60',null,null); INSERT INTO dm_product VALUES(null,'《森林趣事》','2皮影剧—《森林趣事》','2018.02.19-03.03','上海','上海仙乐斯演艺厅','kids亲子','65',null,null); INSERT INTO dm_product VALUES(null,'《狮子王》','儿童剧《狮子王》','2018.02.20','舟山','舟山普陀大剧院','kids亲子','70',null,null); INSERT INTO dm_product VALUES(null,'托马斯嘉年华','托马斯&朋友-嘉年华!来了!','2018.02.21','无锡','无锡大剧院 歌剧厅','kids亲子','99',null,null); INSERT INTO dm_product VALUES(null,'海底小纵队2—火山大冒险','英国BBC大型互动式冒险儿童剧 海底小纵队—火山大冒险(2018)','2018.02.22','上海','艺海剧院','kids亲子','100',null,null); INSERT INTO dm_product VALUES(null,'大头兵','大型奇幻互动式儿童剧《大头兵》','2018.02.16—03.04','太原','山西龙城实验剧场','kids亲子','98',null,null); INSERT INTO dm_product VALUES(null,'孙悟空决战黄风岭','儿童剧《孙悟空决战黄风岭》','2018.02.24','上海','小伙伴剧场','kids亲子','100',null,null); INSERT INTO dm_product VALUES(null,'《新三打白骨精之我是大英雄》','大型戏曲动漫舞台剧《新三打白骨精之我是大英雄》(2月)','2018.02.10-02.25','北京','中国木偶剧院大剧场','kids亲子','98',null,null); CREATE TABLE dm_product_pic( id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, pid INT NOT NULL, sm VARCHAR(128) DEFAULT NULL, md VARCHAR(128) NOT NULL, lg VARCHAR(128) DEFAULT NULL, FOREIGN KEY(pid) REFERENCES dm_product(pid) ); INSERT INTO dm_product_pic VALUES(null,1,'','../img/kids/md/140348_n.jpg','../img/kids/lg/kids_01.jpg'); INSERT INTO dm_product_pic VALUES(null,2,'','../img/kids/md/142704_n.jpg','../img/kids/lg/kids_02.jpg'); INSERT INTO dm_product_pic VALUES(null,3,'','','../img/kids/lg/kids_03.jpg'); INSERT INTO dm_product_pic VALUES(null,4,'../img/kids/sm/2121158981.jpg','../img/kids/md/139637_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,5,'../img/kids/sm/2121310299.jpg','../img/kids/md/140507_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,6,'../img/kids/sm/2121417567.jpg','../img/kids/md/139635_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,7,'../img/kids/sm/2121826934.jpg','../img/kids/md/137738_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,8,'../img/kids/sm/2122341231.jpg','../img/kids/md/141491_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,9,'../img/kids/sm/21225288.jpg','../img/kids/md/138824_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,10,'../img/kids/sm/2123531582.jpg','../img/kids/md/127932_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,11,'../img/kids/sm/2123640663.jpg','../img/kids/md/137430_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,12,'../img/kids/sm/2123824397.jpg','../img/kids/md/126488_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,13,'../img/kids/sm/2123937698.jpg','../img/kids/md/141737_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,14,'../img/kids/sm/212403713.jpg','../img/kids/md/129699_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,15,'../img/kids/sm/212423627.jpg','../img/kids/md/140729_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,16,'../img/kids/sm/2124322677.jpg','../img/kids/md/139285_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,17,'../img/kids/sm/2124417212.jpg','../img/kids/md/139142_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,18,'../img/kids/sm/212456487.jpg','../img/kids/md/140082_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,19,'../img/kids/sm/2124611730.jpg','../img/kids/md/140670_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,20,'../img/kids/sm/212471598.jpg','../img/kids/md/136925_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,21,'../img/kids/sm/212481263.jpg','../img/kids/md/136863_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,22,'../img/kids/sm/212494181.jpg','../img/kids/md/141511_n.jpg',''); INSERT INTO dm_product_pic VALUES(null,23,'../img/kids/sm/2125059362.jpg','../img/kids/md/141396_n.jpg','');
true
3ae6475c87dde91ebed42e7d245fcc4a1ef5c29b
SQL
sfoster2008/bamazon
/bamazon.sql
UTF-8
707
2.859375
3
[]
no_license
CREATE DATABASE bamazon; USE bamazon; CREATE TABLE products ( item_id INT NOT NULL AUTO_INCREMENT, product_name VARCHAR(64) NOT NULL, dept_name VARCHAR(32) NOT NULL, price DECIMAL (10,2) NOT NULL, quantity INT NOT NULL, PRIMARY KEY (item_id) ); INSERT INTO products (product_name, dept_name, price, quantity) VALUES ("Blaster", "Weapons", 80.00, 30), ("Transport", "Vehicles", 15000.00, 5), ("R2-D2", "Droids", 2000.00, 1), ("Crossbow", "Weapons", 150.00, 15), ("X-Wing", "Vehicles", 12000.00, 3), ("C-3P0", "Droids", 900.00, 1), ("Lightsaber", "Weapons", 2500.00, 5), ("R5-D4", "Droids", 200.00, 1), ("Landspeeder", "Vehicles", 800.00, 5), ("AT-AT", "Vehicles", 10000.00, 3);
true
323b0ac7d57f7f58b83f74daa552f05a02050eec
SQL
naresh-nandu/NanduGST
/WePGSTDB/dbo/Stored Procedures/usp_Update_Invoices_MissingInGSTR2A.sql
UTF-8
10,973
3.671875
4
[]
no_license
 /* (c) Copyright 2017 WEP Solutions Pvt. Ltd.. All rights reserved Description : Procedure to Update Invoices missing in GSTR2A Written by : Sheshadri.mk@wepdigital.com Date Who Decription 07/31/2017 Seshadri Initial Version 11/02/2017 Seshadri Modified the code related to Accept Flag 11/03/2017 Seshadri Fixed the issue of duplicate item detail insertion & ITC issue in CDNR */ /* Sample Procedure Call exec usp_Update_Invoices_MissingInGSTR2A */ CREATE PROCEDURE [usp_Update_Invoices_MissingInGSTR2A] @ActionType varchar(15), @Gstin varchar(15), @Activity varchar(2), -- A : 'Accept' R : 'Reject' T : 'Trigger' @RefId int, @UserId int, @CustId int -- /*mssx*/ With Encryption as Begin Set Nocount on if @ActionType = 'B2B' Begin if @Activity = 'A' Begin if Exists(Select 1 From TBL_GSTR2_B2B_INV Where invid = @RefId) Begin Select space(50) as gstr2aid, space(50) as b2bid, space(50) as invid, space(50) as itmsid, t1.gstin,t2.gstinid,t1.fp,t1.ctin, t1.chksum,t1.inum,t1.idt,t1.val,t1.flag,t1.rchrg,t1.pos,t1.inv_typ, t1.num,t1.rt,t1.txval, t1.iamt,t1.camt,t1.samt,t1.csamt, t1.elg,t1.tx_i, t1.tx_c,t1.tx_s,t1.tx_cs Into #TBL_GSTR2_B2B From ( SELECT gstin,fp,ctin, chksum,inum,idt,val,flag,rchrg,pos,inv_typ, num,rt,txval, iamt,camt,samt,csamt, elg,tx_i,tx_c,tx_s,tx_cs From TBL_GSTR2 t1 Inner Join TBL_GSTR2_B2B t2 On t2.gstr2id = t1.gstr2id Inner Join TBL_GSTR2_B2B_INV t3 On t3.b2bid = t2.b2bid Inner Join TBL_GSTR2_B2B_INV_ITMS t4 On t4.invid = t3.invid Inner Join TBL_GSTR2_B2B_INV_ITMS_DET t5 On t5.itmsid = t4.itmsid left outer Join TBL_GSTR2_B2B_INV_ITMS_ITC t6 On t6.itmsid = t4.itmsid Where t3.invid = @RefId )t1 Cross Apply ( Select gstinid from TBL_Cust_GSTIN where gstinno = t1.gstin )t2 -- Insert Records into Table TBL_GSTR2A Insert TBL_GSTR2A (gstin,gstinId,fp) Select distinct gstin,gstinid,fp From #TBL_GSTR2_B2B t1 Where Not Exists(Select 1 From TBL_GSTR2A t2 Where t2.gstin = t1.gstin and t2.fp = t1.fp) Update #TBL_GSTR2_B2B SET #TBL_GSTR2_B2B.gstr2aid = t2.GSTR2aid FROM #TBL_GSTR2_B2B t1, TBL_GSTR2A t2 WHERE t1.gstin = t2.gstin And t1.gstinid = t2.gstinid And t1.fp = t2.fp -- Insert Records into Table TBL_GSTR2A_B2B Insert TBL_GSTR2A_B2B(gstr2aid,ctin,gstinid) Select distinct gstr2aid,ctin,gstinid From #TBL_GSTR2_B2B t1 Where Not Exists ( SELECT 1 FROM TBL_GSTR2A_B2B t2 where t2.GSTR2aid = t1.GSTR2aid and t2.ctin = t1.ctin) Update #TBL_GSTR2_B2B SET #TBL_GSTR2_B2B.b2bid = t2.b2bid FROM #TBL_GSTR2_B2B t1, TBL_GSTR2A_B2B t2 WHERE t1.gstr2aid = t2.gstr2aid And t1.ctin = t2.ctin -- Insert Records into Table TBL_GSTR2A_B2B_INV Insert TBL_GSTR2A_B2B_INV (b2bid,chksum,inum,idt,val,flag,rchrg,pos,inv_typ,gstinid,gstr2aid) Select distinct t1.b2bid,t1.chksum,t1.inum,t1.idt,t1.val, @Activity,t1.rchrg,t1.pos,t1.inv_typ,t1.gstinid,t1.gstr2aid From #TBL_GSTR2_B2B t1 Where Not Exists ( SELECT 1 FROM TBL_GSTR2A_B2B_INV t2 Where t2.b2bid = t1.b2bid And t2.inum = t1.inum And t2.idt = t1.idt) Update #TBL_GSTR2_B2B SET #TBL_GSTR2_B2B.invid = t2.invid FROM #TBL_GSTR2_B2B t1, TBL_GSTR2A_B2B_INV t2 WHERE t1.b2bid= t2.b2bid And t1.inum = t2.inum And t1.idt = t2.idt Insert TBL_GSTR2A_B2B_INV_ITMS (invid,num,gstinid,gstr2aid) Select distinct t1.invid,t1.num,t1.gstinid,t1.gstr2aid From #TBL_GSTR2_B2B t1 Where Not Exists ( SELECT 1 FROM TBL_GSTR2A_B2B_INV_ITMS t2 Where t2.invid = t1.invid And t2.num = t1.num) Update #TBL_GSTR2_B2B SET #TBL_GSTR2_B2B.itmsid = t2.itmsid FROM #TBL_GSTR2_B2B t1, TBL_GSTR2A_B2B_INV_ITMS t2 WHERE t1.invid= t2.invid And t1.num = t2.num Insert TBL_GSTR2A_B2B_INV_ITMS_DET (itmsid,rt,txval,iamt,camt,samt,csamt,gstinid,gstr2aid) Select itmsid,rt,txval,iamt,camt,samt,csamt,gstinid,gstr2aid From #TBL_GSTR2_B2B t1 Where Not Exists ( SELECT 1 FROM TBL_GSTR2A_B2B_INV_ITMS_DET t2 Where t2.itmsid = t1.itmsid) /* Update TBL_GSTR2_B2B_INV Set flag='A' Where invid= @RefId */ Insert into TBL_RECONCILIATION_LOGS (Gstin,InvoiceId,GSTRType,ActionType,Flag,Chksum,CreatedBy,CustId,CreatedDate,Rowstatus) Values(@Gstin,@RefId ,'GSTR2',@ActionType, @Activity,'',@UserId,@CustId,GETDATE(),1) End End else if @Activity = 'R' Begin Update TBL_GSTR2_B2B_INV Set flag='R' Where invid= @RefId if @@ROWCOUNT>0 Begin Insert into TBL_RECONCILIATION_LOGS (Gstin,InvoiceId,GSTRType,ActionType,Flag,Chksum,CreatedBy,CustId,CreatedDate,Rowstatus) Values(@Gstin,@RefId ,'GSTR2',@ActionType, @Activity,'',@UserId,@CustId,GETDATE(),1) End End else if @Activity = 'P' Begin Update TBL_GSTR2_B2B_INV Set flag='P' Where invid= @RefId if @@ROWCOUNT>0 Begin Insert into TBL_RECONCILIATION_LOGS (Gstin,InvoiceId,GSTRType,ActionType,Flag,Chksum,CreatedBy,CustId,CreatedDate,Rowstatus) Values(@Gstin,@RefId ,'GSTR2',@ActionType, @Activity,'',@UserId,@CustId,GETDATE(),1) End End End else if @ActionType = 'CDNR' or @ActionType = 'CDN' Begin if @Activity = 'A' Begin if Exists(Select 1 From TBL_GSTR2_CDNR_NT Where invid = @RefId) Begin Select space(50) as gstr2aid, space(50) as cdnrid, space(50) as ntid, space(50) as itmsid, t1.gstin,t2.gstinid,t1.fp,t1.ctin, t1.chksum,t1.flag,t1.ntty,t1.nt_num,t1.nt_dt,t1.rsn,t1.p_gst, t1.inum,t1.idt,t1.num, t1.rt,t1.txval, t1.iamt,t1.camt,t1.samt,t1.csamt, t1.elg,t1.tx_i, t1.tx_c,t1.tx_s,t1.tx_cs Into #TBL_GSTR2_CDNR From ( SELECT gstin,fp,ctin, chksum,flag,ntty,nt_num,nt_dt,rsn,p_gst, inum,idt,num, rt,txval,iamt,camt,samt,csamt, elg,tx_i,tx_c,tx_s,tx_cs From TBL_GSTR2 t1 Inner Join TBL_GSTR2_CDNR t2 On t2.gstr2id = t1.gstr2id Inner Join TBL_GSTR2_CDNR_NT t3 On t3.cdnrid = t2.cdnrid Inner Join TBL_GSTR2_CDNR_NT_ITMS t4 On t4.invid = t3.invid Inner Join TBL_GSTR2_CDNR_NT_ITMS_DET t5 On t5.itmsid = t4.itmsid left outer Join TBL_GSTR2_CDNR_NT_ITMS_ITC t6 On t6.itmsid = t4.itmsid Where t3.invid = @RefId )t1 Cross Apply ( Select gstinid from TBL_Cust_GSTIN where gstinno = t1.gstin )t2 -- Insert Records into Table TBL_GSTR2A Insert TBL_GSTR2A (gstin,gstinId,fp) Select distinct gstin,gstinid,fp From #TBL_GSTR2_CDNR t1 Where Not Exists(Select 1 From TBL_GSTR2A t2 Where t2.gstin = t1.gstin and t2.fp = t1.fp) Update #TBL_GSTR2_CDNR SET #TBL_GSTR2_CDNR.gstr2aid = t2.GSTR2aid FROM #TBL_GSTR2_CDNR t1, TBL_GSTR2A t2 WHERE t1.gstin = t2.gstin And t1.gstinid = t2.gstinid And t1.fp = t2.fp -- Insert Records into Table TBL_GSTR2A_CDNR Insert TBL_GSTR2A_CDNR(gstr2aid,ctin,gstinid) Select distinct gstr2aid,ctin,gstinid From #TBL_GSTR2_CDNR t1 Where Not Exists ( SELECT 1 FROM TBL_GSTR2A_CDNR t2 where t2.gstr2aid = t1.gstr2aid and t2.ctin = t1.ctin) Update #TBL_GSTR2_CDNR SET #TBL_GSTR2_CDNR.cdnrid = t2.cdnrid FROM #TBL_GSTR2_CDNR t1, TBL_GSTR2A_CDNR t2 WHERE t1.gstr2aid = t2.gstr2aid And t1.ctin = t2.ctin -- Insert Records into Table TBL_GSTR2A_CDNR_NT Insert TBL_GSTR2A_CDNR_NT (cdnrid,flag,chksum,ntty,nt_num,nt_dt,rsn,p_gst,inum,idt,gstinid,gstr2aid) Select distinct t1.cdnrid,@Activity,t1.chksum,t1.ntty,t1.nt_num,t1.nt_dt,t1.rsn,t1.p_gst, t1.inum,t1.idt,t1.gstinid,t1.gstr2aid From #TBL_GSTR2_CDNR t1 Where Not Exists ( SELECT 1 FROM TBL_GSTR2A_CDNR_NT t2 Where t2.cdnrid = t1.cdnrid And t2.inum = t1.inum And t2.idt = t1.idt) Update #TBL_GSTR2_CDNR SET #TBL_GSTR2_CDNR.ntid = t2.ntid FROM #TBL_GSTR2_CDNR t1, TBL_GSTR2A_CDNR_NT t2 WHERE t1.cdnrid= t2.cdnrid And t1.inum = t2.inum And t1.idt = t2.idt Insert TBL_GSTR2A_CDNR_NT_ITMS (ntid,num,gstinid,gstr2aid) Select distinct t1.ntid,t1.num,t1.gstinid,t1.gstr2aid From #TBL_GSTR2_CDNR t1 Where Not Exists ( SELECT 1 FROM TBL_GSTR2A_CDNR_NT_ITMS t2 Where t2.ntid = t1.ntid And t2.num = t1.num) Update #TBL_GSTR2_CDNR SET #TBL_GSTR2_CDNR.itmsid = t2.itmsid FROM #TBL_GSTR2_CDNR t1, TBL_GSTR2A_CDNR_NT_ITMS t2 WHERE t1.ntid= t2.ntid And t1.num = t2.num Insert TBL_GSTR2A_CDNR_NT_ITMS_DET (itmsid,rt,txval,iamt,camt,samt,csamt,gstinid,gstr2aid) Select itmsid,rt,txval,iamt,camt,samt,csamt,gstinid,gstr2aid From #TBL_GSTR2_CDNR t1 Where Not Exists ( SELECT 1 FROM TBL_GSTR2A_CDNR_NT_ITMS_DET t2 Where t2.itmsid = t1.itmsid) /* Update TBL_GSTR2_CDNR_NT Set flag='A' Where invid= @RefId */ Insert into TBL_RECONCILIATION_LOGS (Gstin,InvoiceId,GSTRType,ActionType,Flag,Chksum,CreatedBy,CustId,CreatedDate,Rowstatus) Values(@Gstin,@RefId ,'GSTR2',@ActionType, @Activity,'',@UserId,@CustId,GETDATE(),1) End End else if @Activity = 'R' Begin Update TBL_GSTR2_CDNR_NT Set flag='R' Where invid= @RefId if @@ROWCOUNT>0 Begin Insert into TBL_RECONCILIATION_LOGS (Gstin,InvoiceId,GSTRType,ActionType,Flag,Chksum,CreatedBy,CustId,CreatedDate,Rowstatus) Values(@Gstin,@RefId ,'GSTR2',@ActionType, @Activity,'',@UserId,@CustId,GETDATE(),1) End End else if @Activity = 'P' Begin Update TBL_GSTR2_CDNR_NT Set flag='P' Where invid= @RefId if @@ROWCOUNT>0 Begin Insert into TBL_RECONCILIATION_LOGS (Gstin,InvoiceId,GSTRType,ActionType,Flag,Chksum,CreatedBy,CustId,CreatedDate,Rowstatus) Values(@Gstin,@RefId ,'GSTR2',@ActionType, @Activity,'',@UserId,@CustId,GETDATE(),1) End End End Return 0 End
true
bd7ab3146057df194c5653154d0f3e0c4d3e9fed
SQL
arjun0419/databases
/server/schema.sql
UTF-8
883
3.5
4
[]
no_license
DROP DATABASE chat; CREATE DATABASE chat; USE chat; CREATE TABLE messages ( /* Describe your table here.*/ id int auto_increment, message varchar(300), roomname varchar(40), username varchar(50) REFERENCES users(id), PRIMARY KEY (id) ); /* Create other tables and define schemas for them here! */ CREATE TABLE users ( /* Describe your table here.*/ id int auto_increment, username varchar(30), primary key (id) ); -- create table students (name varchar(20), -- age int(3), campus varchar(20), id int auto_increment, primary key (id) ); /* Execute this file from the command line by typing: * mysql -u root < server/schema.sql * to create the database and the tables.*/ -- insert into users (id, username) values -- (0,'weHateSql69'); -- insert into messages (id, messages, userID) values -- (0, 'trololololololololol', 0) --
true
12efcd9cf9163773efd5440155a55e0e19a892c7
SQL
leobancosta/devsecops
/backend/dso-mysql/sprint_userstory/init.sql
UTF-8
493
3.03125
3
[]
no_license
CREATE DATABASE dso; GRANT ALL PRIVILEGES ON dso.* TO 'dsouserstory'@'%' IDENTIFIED BY 'dsopass'; GRANT ALL PRIVILEGES ON dso.* TO 'dsosprintuserstory'@'localhost' IDENTIFIED BY 'dsopass'; USE dso; CREATE TABLE sprint_userstory ( sprint_userstory_id INT NOT NULL AUTO_INCREMENT PRIMARY_KEY, sprint_id INT NOT NULL, userstory_id INT NOT NULL, project_id INT NOT NULL, created_date DATETIME, updated_date DATETIME, created_by INT, updated_by INT, status TINYINT NOT NULL DEFAULT 0 );
true
18ea0ca2f39ea17e4afc17fcb8ba8006cb2ece2c
SQL
andrecontisilva/SQL-aprendizado
/HackerRank/SQL-MSServer/HackerRank_SQL-MSServer_WeatherObservationStation2.sql
UTF-8
866
3.484375
3
[ "MIT" ]
permissive
/* Site: HackerRank Type: Practice Subdomain: Aggregation Difficulty: Easy Skill: SQL (MS Server) Problem: Weather Observation Station 2 URL: https://www.hackerrank.com/challenges/weather-observation-station-2/problem */ -- SOLUTION: -- v1: Using FORMAT() with 'F2' SELECT FORMAT(ROUND(SUM(lat_n),2),'F2'), FORMAT(ROUND(SUM(long_w),2),'F2') FROM station -- v2: Using FORMAT() with '#.00' SELECT FORMAT(ROUND(SUM(lat_n),2),'#.00'), FORMAT(ROUND(SUM(long_w),2),'#.00') FROM station /* NOTE: More about the FORMAT function: https://docs.microsoft.com/pt-br/sql/t-sql/functions/format-transact-sql?view=sql-server-ver15 https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings?redirectedfrom=MSDN https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings?redirectedfrom=MSDN */
true
62bf45e0907861401c18664fad4fcb32c45b2d97
SQL
tsmit317/ITCS-3160-Homework
/Assignment03/ITCS_3160Assignment3.sql
UTF-8
1,437
3.609375
4
[]
no_license
/*Taylor Smith ITCS 3160 Assignment 3 */ USE PRETTYPRINTS; /* 1. */ SELECT Customer_name, customer_add, customer_city, customer_state, customer_zip FROM Customers ; /* 2. */ SELECT customer_name, customer_phone FROM Customers WHERE customer_state = 'GA' ; /* 3. */ SELECT customer_name, customer_zip FROM Customers WHERE customer_state = 'NC' OR customer_state = 'SC' ; /* 4. */ SELECT Items.title, Items.artist, Orders.order_date, Orders.ship_date FROM Orders, Items, Orderline WHERE Orders.order_id = Orderline.order_id AND Items.item_id = Orderline.item_id ; /* 5. */ SELECT item_id, title, artist, unit_price, on_hand FROM Items ORDER BY unit_price ; /* 6. */ SELECT item_id, title, artist, unit_price, on_hand FROM Items WHERE unit_price > 100 ; /* 7. */ SELECT item_id, title, artist, unit_price, on_hand FROM Items WHERE on_hand > 300 ; /* 8. */ SELECT title, unit_price, (unit_price*2) AS retail_price FROM Items ; /* 9. */ SELECT Customers.customer_name, Customers.customer_phone FROM Customers, Orders WHERE Customers.customer_id = Orders.customer_id AND (Orders.order_date) LIKE '2014-00-00' ; /* 10. */ SELECT Items.artist, SUM(Orderline.order_qty) FROM Items, Orderline WHERE Orderline.item_id = Items.item_id ; /* 11. */ SELECT title FROM Items WHERE unit_price BETWEEN 40 AND 100 ; /* 12. */ /* 13. */ /* 14. */ SELECT Customer_state, COUNT(customer_id) FROM Customers WHERE customer_state ;
true
30b45d2b47bf810f5022e4a6d70afcdb8ccf676d
SQL
christinaashworth/PoKi
/SQLQuery2.sql
UTF-8
3,960
4.40625
4
[]
no_license
 -- What grades are stored in the database? SELECT * FROM Grade; -- What emotions may be associated with a poem? SELECT e.Name FROM Emotion e; -- How many poems are in the database? SELECT Count(Poem.Id) AS NumberOfPoems FROM Poem; -- Sort authors alphabetically by name. What are the names of the top 76 authors? SELECT Top 76 a.Name FROM Author a ORDER BY a.Name asc; -- Starting with the above query, add the grade of each of the authors. SELECT Top 76 a.Name as AuthorName, g.Name as GradeName FROM Author a LEFT JOIN Grade g ON a.GradeId = g.Id ORDER BY a.Name asc; -- Starting with the above query, add the recorded gender of each of the authors. SELECT Top 76 a.Name as AuthorName, g.Name as GradeName, gen.Name as GenderName FROM Author a LEFT JOIN Grade g ON a.GradeId = g.Id LEFT JOIN Gender gen ON a.GenderId = gen.Id ORDER BY a.Name asc; -- What is the total number of words in all poems in the database? SELECT SUM(WordCount) From Poem p; -- Which poem has the fewest characters? SELECT Top 1 p.Title, p.charCount FROM Poem p ORDER BY p.charCount asc; -- How many authors are in the third grade? SELECT COUNT(a.Id) FROM Author a LEFT JOIN Grade g ON a.GradeId = g.Id WHERE g.Name = '3rd Grade'; -- How many authors are in the first, second or third grades? SELECT COUNT(a.Id) AS First2nd3rdGradeAuthors FROM Author a LEFT JOIN Grade g ON a.GradeId = g.Id WHERE g.Name = '3rd Grade' OR g.Name = '2nd Grade' OR g.Name = '1st Grade'; -- What is the total number of poems written by fourth graders? SELECT COUNT(p.Id) AS NumberOf4thGradePoems FROM Poem p LEFT JOIN Author a ON p.AuthorId = a.Id LEFT JOIN Grade g ON a.GradeId = g.Id WHERE g.Name = '4th Grade'; -- How many poems are there per grade? SELECT COUNT(p.Id) AS NumberOfPoems, g.Name FROM Poem p LEFT JOIN Author a ON p.AuthorId = a.Id LEFT JOIN Grade g ON a.GradeId = g.Id GROUP BY g.Name ORDER BY g.Name asc; -- How many authors are in each grade? (Order your results by grade starting with 1st Grade) SELECT COUNT(a.Id) AS NumberOfAuthors, g.Name FROM Author a LEFT JOIN Grade g ON a.GradeId = g.Id GROUP BY g.Name ORDER BY g.Name asc; -- What is the title of the poem that has the most words? SELECT TOP 1 p.Title, p.WordCount FROM Poem p ORDER BY p.WordCount desc; -- Which author(s) have the most poems? (Remember authors can have the same name.) SELECT a.Id, a.Name, COUNT(p.Id) AS NumberOfPoems FROM Author a JOIN Poem p on a.Id = p.AuthorId GROUP BY a.Id, a.Name ORDER BY NumberOfPoems desc -- How many poems have an emotion of sadness? SELECT COUNT(pe.Id) AS SadPoems FROM PoemEmotion pe LEFT JOIN Emotion e ON pe.EmotionId = e.Id WHERE Name = 'Sadness' -- How many poems are not associated with any emotion? SELECT Name, COUNT(p.Id) FROM Poem p LEFT JOIN PoemEmotion pe ON p.Id = pe.PoemId LEFT JOIN Emotion e ON pe.EmotionId = e.Id WHERE Name IS NULL GROUP BY Name -- Which emotion is associated with the least number of poems? SELECT Top 1 Name, COUNT(p.Id) AS NumOfPoems FROM Poem p LEFT JOIN PoemEmotion pe ON p.Id = pe.PoemId LEFT JOIN Emotion e ON pe.EmotionId = e.Id WHERE Name IS NOT NULL GROUP BY Name ORDER BY NumOfPoems asc; -- Which grade has the largest number of poems with an emotion of joy? SELECT TOP 1 g.Name AS GradeName, e.Name AS EmotionName, Count(p.Id) FROM Poem p LEFT JOIN PoemEmotion pe ON p.Id = pe.PoemId LEFT JOIN Emotion e ON pe.EmotionId = e.Id LEFT JOIN Author a ON p.AuthorId = a.Id LEFT JOIN Grade g ON a.GradeId = g.Id WHERE e.Name = 'Joy' GROUP BY g.Name, e.Name ORDER BY G.Name desc; -- Which gender has the least number of poems with an emotion of fear? SELECT TOP 1 g.Name AS GenderName, e.Name AS EmotionName, Count(p.Id) FROM Poem p LEFT JOIN PoemEmotion pe ON p.Id = pe.PoemId LEFT JOIN Emotion e ON pe.EmotionId = e.Id LEFT JOIN Author a ON p.AuthorId = a.Id LEFT JOIN Gender g ON a.GenderId = g.Id WHERE e.Name = 'Fear' GROUP BY g.Name, e.Name ORDER BY G.Name asc;
true
1e04a320a409daaf2e1159afca266fdd24635514
SQL
LioKr/parkshark-fisher
/src/main/java/com/switchfully/parksharkfisher/domain/dbscripts/createTable.sql
UTF-8
3,007
3.765625
4
[]
no_license
drop table if exists divisions cascade; create table divisions ( id uuid not null constraint divisions_pk primary key, division_name varchar(60) not null, original_name varchar(60), director varchar(60) not null ); create table address ( id uuid constraint address_pk primary key, streetname varchar(25), number varchar(10), postalcode varchar(8), city varchar(25) ); create table contactpersons ( id uuid constraint contactpersons_pk primary key, firstname varchar(15), lastname varchar(15), mobilephone varchar(25), telephone varchar(25), emailaddress varchar(32), address_id uuid, constraint contactpersons_address_id_fk foreign key (address_id) references address (id) ); create table parkinglots ( id integer default nextval('parkinglot_seq'::regclass) not null constraint parkinglots_pkey primary key, category varchar(255), maxcapacity integer, name varchar(255), price bigint, spots_in_use integer, address_id uuid constraint fk3b6fo74f3eflrpaafoeyli5qo references address, contactperson_id uuid constraint fkgmoe8jbe1g28cxrj15c7qecko references contactpersons, division_id uuid not null constraint fkbfjsvqey0m0k5ssx2i2m3o3h6 references divisions ); create table license_plate ( plate_number varchar(60) not null constraint license_plate_pk primary key, issuing_country varchar(60) not null ); create table members ( id uuid not null constraint members_pk primary key, firstname varchar(60) not null, lastname varchar(60) not null, phone_number varchar(60) not null, mail varchar(60) not null, license_plate_platenumber varchar(60) not null constraint members_license_plate_plate_number_fk references license_plate, registration_date date not null, address_id uuid not null constraint members_address_id_fk references address, membership text ); create table allocations ( id bigint default nextval('allocations_seq'::regclass) not null constraint allocations_pkey primary key, start_time date, stop_time date, member_id uuid not null constraint allocations_member_id_fk references members, parkinglot_id integer not null constraint allocations_parkinglot_id_fk references parkinglots );
true
5e88720554746a9c8ee65bc9e2d60e8a3691fe35
SQL
method5/method5.github.io
/presentations/Method5 demo without showing target names.sql
UTF-8
2,571
3.1875
3
[ "MIT" ]
permissive
-------------------------------------------------------------------------------- --Method5 live demo for presentations. --(Normally these statements would include a simpler "select *", but I used -- some extra code to hide the target names.) -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --#1: Simple function. -------------------------------------------------------------------------------- select ora_hash(database_name), startup_time from table(m5('select startup_time from v$instance', 'dev,qa')); -------------------------------------------------------------------------------- --#2: Simple procedure. First gather the data asynchronously. -------------------------------------------------------------------------------- begin m5_proc( p_code => q'[ begin dbms_output.put_line('Hello, World!'); end; ]', p_targets => 'dev,qa', p_table_name => 'test_data', p_table_exists_action => 'drop', p_asynchronous => true, p_run_as_sys => false ); end; / --Then check the results, metadata, and errors. select ora_hash(database_name) database_name, to_char(result) result from m5_results order by database_name; select * from m5_metadata order by date_started; select ora_hash(database_name) database_name, ora_hash(db_link_name) db_link_name, date_error, error_stack_and_backtrace from m5_errors order by database_name; -------------------------------------------------------------------------------- --#3: Shell script. -------------------------------------------------------------------------------- select ora_hash(host_name) host_name, line_number, output from table(m5('#!/bin/ksh' || chr(10) || 'df -h|grep /tmp;', 'qa')); -------------------------------------------------------------------------------- --#4: Global data dictionary - DBA_USERS. -------------------------------------------------------------------------------- select ora_hash(database_name) database_name from m5_dba_users where username = 'SYSTEM' order by database_name; -------------------------------------------------------------------------------- --#5: Global data dictionary - V$PARAMETER. -------------------------------------------------------------------------------- select ora_hash(database_name), display_value from m5_v$parameter where name = 'resumable_timeout' order by database_name;
true
a45b51e2bcf6cbf79796b682a5073edaa4481cfb
SQL
CarlosZr09/HotelFaraon
/basereservanew.sql
UTF-8
7,978
3.296875
3
[]
no_license
-- MySQL Script generated by MySQL Workbench -- 03/22/18 11:01:41 -- 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='TRADITIONAL,ALLOW_INVALID_DATES'; -- ----------------------------------------------------- -- Schema BaseReservaNew -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema BaseReservaNew -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `BaseReservaNew` DEFAULT CHARACTER SET utf32 ; USE `BaseReservaNew` ; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`habitación` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`habitación` ( `idhabitación` INT NOT NULL AUTO_INCREMENT, `numero` VARCHAR(4) NOT NULL, `piso` VARCHAR(2) NOT NULL, `descripcion` VARCHAR(255) NULL, `caracteristicas` VARCHAR(512) NULL, `precio_diario` DOUBLE NOT NULL, `estado` VARCHAR(45) NULL, `precio_x3h` DOUBLE NOT NULL, `precio_xh` DOUBLE NOT NULL, `habitacióncol` VARCHAR(45) NULL, PRIMARY KEY (`idhabitación`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`persona` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`persona` ( `idpersona` INT NOT NULL AUTO_INCREMENT, `nombre` VARCHAR(20) NOT NULL, `apaterno` VARCHAR(20) NOT NULL, `amaterno` VARCHAR(20) NOT NULL, `tipo_documento` VARCHAR(15) NOT NULL, `num_documento` VARCHAR(8) NOT NULL, `direccion` VARCHAR(100) NULL, `telefono` VARCHAR(8) NULL, `email` VARCHAR(25) NULL, PRIMARY KEY (`idpersona`), UNIQUE INDEX `email_UNIQUE` (`email` ASC), UNIQUE INDEX `telefono_UNIQUE` (`telefono` ASC)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`trabajador` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`trabajador` ( `idpersona` INT NOT NULL AUTO_INCREMENT, `sueldo` DOUBLE NOT NULL, `acceso` VARCHAR(15) NULL, `login` VARCHAR(15) NULL, `password` VARCHAR(20) NULL, `estado` VARCHAR(1) NOT NULL, PRIMARY KEY (`idpersona`), CONSTRAINT `fk_persona_trabajador` FOREIGN KEY (`idpersona`) REFERENCES `BaseReservaNew`.`persona` (`idpersona`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB COMMENT = ' '; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`cliente` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`cliente` ( `idpersona` INT NOT NULL, `codigo_cliente` INT NOT NULL, PRIMARY KEY (`idpersona`), UNIQUE INDEX `codigo_cliente_UNIQUE` (`codigo_cliente` ASC), CONSTRAINT `fk_persona_cliente` FOREIGN KEY (`idpersona`) REFERENCES `BaseReservaNew`.`persona` (`idpersona`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`producto` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`producto` ( `idproducto` INT NOT NULL AUTO_INCREMENT, `nombre` VARCHAR(45) NOT NULL, `descripcion` VARCHAR(255) NULL, `unidad_medida` VARCHAR(20) NOT NULL, `precio_venta` DOUBLE NOT NULL, `stock` VARCHAR(20) NOT NULL, PRIMARY KEY (`idproducto`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`reserva` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`reserva` ( `idreserva` INT NOT NULL AUTO_INCREMENT, `idhabitacion` INT NOT NULL, `idcliente` INT NOT NULL, `idtrabajador` INT NOT NULL, `dia` INT NOT NULL, `mes` INT NOT NULL, `ano` INT NOT NULL, `hora_ingreso` VARCHAR(10) NOT NULL, `hora_salida` VARCHAR(10) NOT NULL, `salida_real` VARCHAR(10) NOT NULL, `costo_alojamiento` DOUBLE NOT NULL, `estado_reserva` VARCHAR(15) NOT NULL, PRIMARY KEY (`idreserva`), INDEX `fk_reserva_habitacion_idx` (`idhabitacion` ASC), INDEX `fk_reserva_cliente_idx` (`idcliente` ASC), INDEX `fk_reserva_trabajador_idx` (`idtrabajador` ASC), CONSTRAINT `fk_reserva_habitacion` FOREIGN KEY (`idhabitacion`) REFERENCES `BaseReservaNew`.`habitación` (`idhabitación`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_reserva_cliente` FOREIGN KEY (`idcliente`) REFERENCES `BaseReservaNew`.`cliente` (`idpersona`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_reserva_trabajador` FOREIGN KEY (`idtrabajador`) REFERENCES `BaseReservaNew`.`trabajador` (`idpersona`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`consumo` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`consumo` ( `idconsumo` INT NOT NULL AUTO_INCREMENT, `idreserva` INT NOT NULL, `idproducto` INT NOT NULL, `cantidad` DOUBLE NULL, `precio_venta` DOUBLE NULL, `estado` INT NULL, PRIMARY KEY (`idconsumo`), INDEX `fk_consumo_producto_idx` (`idproducto` ASC), INDEX `fk_consumo_reserva_idx` (`idreserva` ASC), CONSTRAINT `fk_consumo_producto` FOREIGN KEY (`idproducto`) REFERENCES `BaseReservaNew`.`producto` (`idproducto`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_consumo_reserva` FOREIGN KEY (`idreserva`) REFERENCES `BaseReservaNew`.`reserva` (`idreserva`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`pago` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`pago` ( `idpago` INT NOT NULL, `idereserva` INT NOT NULL AUTO_INCREMENT, `tipo_comprobante` VARCHAR(20) NOT NULL, `num_comprobante` INT NOT NULL, `igv` DOUBLE NOT NULL, `total_pago` DOUBLE NOT NULL, `fecha_emision` VARCHAR(10) NOT NULL, `fecha_pago` VARCHAR(10) NOT NULL, `hora_pago` VARCHAR(10) NOT NULL, `subtotal` DOUBLE NOT NULL, PRIMARY KEY (`idpago`), INDEX `fk_pago_reserva_idx` (`idereserva` ASC), CONSTRAINT `fk_pago_reserva` FOREIGN KEY (`idereserva`) REFERENCES `BaseReservaNew`.`reserva` (`idreserva`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`Regasis` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`Regasis` ( `idpersona` INT NOT NULL AUTO_INCREMENT, `fecha_entrada` VARCHAR(10) NOT NULL, `hora_entrada` VARCHAR(10) NOT NULL, `hora_salida` VARCHAR(10) NOT NULL, PRIMARY KEY (`idpersona`), CONSTRAINT `fk_registro_trabajador` FOREIGN KEY (`idpersona`) REFERENCES `BaseReservaNew`.`trabajador` (`idpersona`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `BaseReservaNew`.`limpieza` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `BaseReservaNew`.`limpieza` ( `idlimpieza` INT NOT NULL AUTO_INCREMENT, `reserva_idreserva` INT NOT NULL, PRIMARY KEY (`idlimpieza`), INDEX `fk_limpieza_reserva1_idx` (`reserva_idreserva` ASC), CONSTRAINT `fk_limpieza_reserva1` FOREIGN KEY (`reserva_idreserva`) REFERENCES `BaseReservaNew`.`reserva` (`idreserva`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
true
4104acf94c8ef0468cfe845ddf49a4d069120215
SQL
gtmsallu/store
/adminpanel/uploads/1591205646_ecommercesite (2).sql
UTF-8
5,143
2.96875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: May 21, 2020 at 01:11 PM -- Server version: 10.1.38-MariaDB -- PHP Version: 7.3.3 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 NAMES utf8mb4 */; -- -- Database: `ecommercesite` -- -- -------------------------------------------------------- -- -- Table structure for table `admininfodata` -- CREATE TABLE `admininfodata` ( `id` int(11) NOT NULL, `email` varchar(202) NOT NULL, `password` varchar(222) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `admininfodata` -- INSERT INTO `admininfodata` (`id`, `email`, `password`) VALUES (2, 'sallu@gmail.com', 'sallu'); -- -------------------------------------------------------- -- -- Table structure for table `adminlogin` -- CREATE TABLE `adminlogin` ( `id` int(11) NOT NULL, `Email` varchar(20) NOT NULL, `Password` varchar(30) NOT NULL, `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_on` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `adminlogin` -- INSERT INTO `adminlogin` (`id`, `Email`, `Password`, `created_on`, `updated_on`) VALUES (1, 'admin@gmail.com', 'admin123', '2020-04-19 12:28:28', '0000-00-00 00:00:00'); -- -------------------------------------------------------- -- -- Table structure for table `reset_password` -- CREATE TABLE `reset_password` ( `id` int(11) NOT NULL, `Email` varchar(40) NOT NULL, `token` varchar(40) NOT NULL, `created_on` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `updated_on` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -------------------------------------------------------- -- -- Table structure for table `userinfodata` -- CREATE TABLE `userinfodata` ( `id` int(11) NOT NULL, `user` varchar(222) NOT NULL, `email` varchar(222) NOT NULL, `password` varchar(20) NOT NULL, `mobile` varchar(222) NOT NULL, `comment` varchar(222) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `userinfodata` -- INSERT INTO `userinfodata` (`id`, `user`, `email`, `password`, `mobile`, `comment`) VALUES (15, 'sallu', 'gtm@gmail.com', 'gtm', '876666', '784374'); -- -------------------------------------------------------- -- -- Table structure for table `user_registration` -- CREATE TABLE `user_registration` ( `ID` int(10) UNSIGNED NOT NULL, `First_Name` varchar(50) NOT NULL, `Last_Name` varchar(50) NOT NULL, `Email` varchar(50) NOT NULL, `Mobile_Number` text NOT NULL, `Password` varchar(50) NOT NULL, `Repeat_Password` varchar(50) NOT NULL, `Created_On` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `Updated_On` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `user_registration` -- INSERT INTO `user_registration` (`ID`, `First_Name`, `Last_Name`, `Email`, `Mobile_Number`, `Password`, `Repeat_Password`, `Created_On`, `Updated_On`) VALUES (27, 'Darryl', 'Molly', 'Molly', '939', 'manakamana', 'manakamana', '2020-04-19 09:20:44', '2020-04-19 11:34:49'), (28, 'sailendra', 'gautam', 'sailendragautam732@gmail.com', '9867015128', 'sallu', 'sallu', '2020-04-19 09:21:22', '2020-04-19 12:11:42'); -- -- Indexes for dumped tables -- -- -- Indexes for table `admininfodata` -- ALTER TABLE `admininfodata` ADD PRIMARY KEY (`id`); -- -- Indexes for table `adminlogin` -- ALTER TABLE `adminlogin` ADD PRIMARY KEY (`id`); -- -- Indexes for table `reset_password` -- ALTER TABLE `reset_password` ADD PRIMARY KEY (`id`); -- -- Indexes for table `userinfodata` -- ALTER TABLE `userinfodata` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user_registration` -- ALTER TABLE `user_registration` ADD PRIMARY KEY (`ID`), ADD UNIQUE KEY `Email` (`Email`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `admininfodata` -- ALTER TABLE `admininfodata` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `adminlogin` -- ALTER TABLE `adminlogin` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `reset_password` -- ALTER TABLE `reset_password` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `userinfodata` -- ALTER TABLE `userinfodata` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- AUTO_INCREMENT for table `user_registration` -- ALTER TABLE `user_registration` MODIFY `ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
6f9805e6597ff48adf396be375cca784cdb346d9
SQL
AbeerHDD/IStore
/boutique2.sql
UTF-8
2,949
2.546875
3
[]
no_license
INSERT INTO `categories` VALUES (1, 'PC-Protable', 1), (2, 'PC-Bureau', 1), (3, 'Tablette', 1), (4, 'Phone', 1); INSERT INTO `produits` VALUES (1, 'Portable Asus', 'Pack Fnac PC Portable Asus R556YI-XX001T', 1, 1600, 1), (2, 'HP Notebook', 'PC Portable HP Notebook 17-x103nf', 1, 1100, 1), (3, 'Asus ROG', 'PC Portable Asus ROG GL552VW-DM881T', 1, 1890, 1), (4, 'Lenovo IdeaPad', 'PC Portable Lenovo IdeaPad 110-15ACL', 1, 1460, 1), (5, 'Asus Zenbook', 'PC Ultra-Portable Asus Zenbook UX305CA-FB153T', 1, 1850, 1), (6, 'MacBook Pro', 'Apple MacBook Pro 13.3 Retina 256 Go SSD', 1, 3250, 1), (7, 'Acer Aspire', 'PC Portable Acer Aspire F5-573G-5417', 1, 1200, 1), (8, 'Lenovo Ideapad', 'PC Ultra-Portable Lenovo Ideapad 100S-14IBR', 1, 1240, 1), (9, 'Asus R457UR', 'PC Ultra-Portable Asus R457UR-WX088T', 1, 1680, 1), (10, 'Asus UX310UA', 'PC Ultra-Portable Asus UX310UA-GL204T', 1, 1250, 1), (11, 'Asus GL552VW', 'PC Portable Asus GL552VW-DM009T ', 1, 1400, 1), (12, 'Lenovo 100', 'PC Portable Lenovo 100-15IBY version 2017', 1, 1500, 1), (13, 'Asus V230ICGK', 'PC Asus V230ICGK-BC222X Tout-en-un 23', 2, 1200, 1), (14, 'Asus K31CD', 'PC Asus K31CD-FR041T version 2017 (images)', 2, 950, 1), (15, 'Apple iMac', 'Apple iMac 21.5 Retina 4K 1 To 8 Go RAM', 2, 3260, 1), (16, 'VIBOX PC Gamer', 'VIBOX PC Gamer - Vision Package 2 - 3.9GHz', 2, 1950, 1), (17, 'Dell Optiplex', 'Unité centrale Dell Optiplex 990 Tour', 2, 1100, 1), (18, 'Dell Optiplex', 'Ordinateur Dell Optiplex 760 SFF version 2017 (images)', 2, 1250, 1), (19, ' tout-en-un tactile ', 'PC tout-en-un tactile ORDISSIMO version 2017', 2, 1850, 1), (20, 'MSI Gaming 24', 'PC MSI Gaming 24 6QD-005EU Tout-en-un', 2, 1620, 1), (21, 'iPad Mini', 'Apple iPad Mini 4 128 Go Wifi Argent 7', 3, 500, 1), (22, 'Galaxy Tab S2', 'Tablette Samsung Galaxy Tab S2 VE 9', 3, 1250, 1), (23, 'iPad Mini 4', 'Apple iPad Mini 4 128 Go Wifi Or iPad Mini 444', 3, 950, 1), (24, 'Galaxy Tab A6', 'Tablette Samsung Galaxy Tab A6 Samsung Galaxy Tab A6 ', 3, 850, 1), (25, 'Tablette Asus', 'Tablette Asus Z300M-6B032A version 2017', 3, 540, 1), (26, 'iPad Pro', 'Apple iPad Pro 128 Go WiFi', 3, 820, 1), (27, 'Lenovo Moto', 'Smartphone Lenovo Moto ZDouble SIM 32 Go Blanc', 4, 260, 1), (28, 'Huawei P8', 'Smartphone Huawei P8 16 Go Blanc', 4, 450, 1), (29, 'Honor 8', 'Smartphone Honor 8 Premium 64 Go Double SIM Or', 4, 650, 1), (30, 'Honor 8 Premium', 'Smartphone Honor 8 Premium 64 Go Double SIM Rose', 4, 850, 1), (31, 'Galaxy J7', 'Smartphone Samsung Galaxy J7 16 Go Blanc', 4, 1020, 1), (32, 'Wiko Fever', 'Smartphone Wiko Fever Edition Spéciale 32 Go Paprika', 4, 450, 1), (33, 'Wiko Fever', 'Smartphone Wiko Fever Edition Spéciale 32 Go Anthracite', 4, 580, 1), (34, 'Galaxy S6', 'Smartphone Samsung Galaxy S6 Edge 32 Go Noir Cosmos', 4, 890, 1), (35, 'Galaxy S6', 'Smartphone Samsung Galaxy S6 Edge 32 Go Or', 4, 895, 1), (36, 'Galaxy S7', 'Smartphone Samsung Galaxy S7 32 Go Or Rose', 4, 1420, 1);
true
56253b5d2d4ee4f5fa144c84837db57034f38c17
SQL
HeeSeok-Kwon/R_study
/R_kmooc1/4weeks/4주차 SQL query.sql
UHC
2,590
3.921875
4
[]
no_license
select * from ֹ order by ȣ; select sum(ǸŰ) as Ѹ from ֹ where ȣ = 2; select sum(ǸŰ) as Ѿ, avg(ǸŰ) as , min(ǸŰ) as ּ, max(ǸŰ) as ִ from ֹ; select count(*) as ǸŰǼ from ֹ; select ȣ, count(*) as , sum(ǸŰ) as ǸѾ from ֹ group by ȣ; select ȣ, count(*) from ֹ where ǸŰ >= 8000 group by ȣ having count(*) >= 2; select * from ; select * from , ֹ; select * from , ֹ where .ȣ = ֹ.ֹȣ; select * from , ֹ where .ȣ = ֹ.ֹȣ order by .ȣ; SELECT ̸, ǸŰ FROM , ֹ WHERE .ȣ = ֹ.ȣ ; select ̸, sum(ǸŰ) as ֹ from , ֹ where .ȣ = ֹ.ȣ group by ̸ order by ̸; select ̸, ̸ from , ֹ, where .ȣ = ֹ.ȣ and ֹ.ȣ = .ȣ; select ̸, ̸ from , ֹ, where .ȣ = ֹ.ȣ and ֹ.ȣ = .ȣ and ǸŰ = 20000; select ̸, ǸŰ from left outer join ֹ on .ȣ = ֹ.ȣ; SELECT ABS(-78), ABS(+78); SELECT ROUND(6834.875, 1); SELECT ROUND(6834.875, 2); SELECT ROUND(6834.875, 0); SELECT ROUND(6834.875, -1); SELECT ROUND(6834.875, -2); select ȣ, round(sum(ǸŰ)/count(*), -2) as " ݾ" from ֹ group by ȣ; select ̸ as , len(̸) as from where ǻ='½'; select substring(̸, 1, 1) , count(*) ο from group by substring(̸, 1, 1) ; select ȣ, ̸, ǻ, from ; select ȣ, replace(̸, '߱', '') ̸, ǻ, from ; select ֹȣ, Ǹ, dateadd(dd, 10, Ǹ) as "Ȯ " from ֹ; select ֹȣ, Ǹ, dateadd(mm, 1, Ǹ) as "Ȯ " from ֹ; select * from ֹ; SELECT SYSDATETIME() as "ð"; SELECT DAY(SYSDATETIME()) as "ó¥" SELECT month(SYSDATETIME()) as ""
true
423a090235ff7975140bae6c8fa6dce56816eade
SQL
404-html/coursework
/Database Systems/CW1/03.sql
UTF-8
134
2.953125
3
[]
no_license
SELECT * FROM Orders O WHERE O.odate < '20160916' AND NOT EXISTS (SELECT 1 FROM Details D WHERE O.ordid = D.ordid);
true
2c38a744cd6e40267d28139be7a2a2c747ca0a7d
SQL
bellmit/kem
/kem/target/classes/upgrade/dbupdater/special_config_tag@10v111.sql
UTF-8
1,032
3.75
4
[]
no_license
CREATE PROCEDURE exe() BEGIN DECLARE ts VARCHAR(50) DEFAULT "{{dataBaseName}}"; DECLARE tn VARCHAR(50) DEFAULT "special_config_tag"; -- 表结构创建: -- 删除例子 -- DROP TABLE IF EXISTS db_ver; -- 创建例子 drop view if exists special_config_tag; IF not EXISTS(SELECT * FROM information_schema.`TABLES` WHERE TABLE_NAME=tn AND TABLE_SCHEMA=ts) THEN CREATE VIEW `special_config_tag` as SELECT DISTINCT 0 AS `tag_id`, `p13`.`parameter` AS `model_config_id`, `p1`.`parameter` AS `tag_name` FROM ( ( `prod_manuscript` `a` LEFT JOIN `prod_parameter` `p13` ON ( ( ( `a`.`manuscript_id` = `p13`.`manuscript_id` ) AND (`p13`.`parameter_type` = 13) AND (`p13`.`enable` = 0) ) ) ) LEFT JOIN `prod_parameter` `p1` ON ( ( ( `a`.`manuscript_id` = `p1`.`manuscript_id` ) AND (`p1`.`parameter_type` = 1) AND (`p1`.`enable` = 0) ) ) ) WHERE ( `a`.`manuscript_type` IN (2, 3) ); END IF; END;
true
aeedba87b6d126df42f4272aeb33423a27d1b418
SQL
emilymendelson/Move-Restore
/Move & Restore/loginsystem.sql
UTF-8
3,152
3.234375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 5.0.2 -- https://www.phpmyadmin.net/ -- -- Host: localhost -- Generation Time: Jul 05, 2020 at 04:58 PM -- Server version: 10.4.11-MariaDB -- PHP Version: 7.4.6 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; 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 NAMES utf8mb4 */; -- -- Database: `loginsystem` -- -- -------------------------------------------------------- -- -- Table structure for table `journal` -- CREATE TABLE `journal` ( `id` int(11) NOT NULL, `uid` varchar(11) NOT NULL, `exercises` text NOT NULL, `comments` mediumtext NOT NULL, `date` text DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `journal` -- INSERT INTO `journal` (`id`, `uid`, `exercises`, `comments`, `date`) VALUES (10, '19', 'test', 'test', '2020-06-30'), (11, '21', 'Test 123', 'Test 123', '2020-06-30'), (12, '19', 'Testing', 'Testing', '2020-06-30'), (14, '19', 'Jumping Jacks', 'I was able to complete more jumping jacks than yesterday.', '2020-07-01'), (16, '19', 'Push up', 'I did 10 push ups!', '2020-06-30'), (17, '19', 'Push ups', 'I did 20 push-ups', '2020-06-30'), (21, '19', 'Testing date', 'Testing date', '2020-07-01'), (22, '19', 'Testing date again', 'Testing date again', 'Wednesday, July 1, 2020'), (23, '19', '- Testing 123\r\n- Test 123\r\n', '- Testing 123\r\n- Test 123\r\n- Hello', 'Wednesday, July 1, 2020'), (24, '19', 'slrkglajed', 'afklnawlfk', 'Wednesday, July 1, 2020'), (25, '19', 'Push ups', 'My back is hurting, but I did 10 push ups today', 'Wednesday, July 1, 2020'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `idUsers` int(11) NOT NULL, `uidUsers` tinytext NOT NULL, `emailUsers` tinytext NOT NULL, `pwdUsers` longtext NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `users` -- INSERT INTO `users` (`idUsers`, `uidUsers`, `emailUsers`, `pwdUsers`) VALUES (17, 'bob12345', 'bob@gmail.com', '$2y$10$0fyXCI4ZEJpypXlfqlvAkOqyVmsvFaJjTFNPbwzgDf7cw8Fr4BKeK'), (18, 'Emily14', '17ecm1@queensu.com', '$2y$10$MEID987Iu8aXIH1fmS66TubVpqZo49NJVZJ7M7o6qkLa32mVMS1Yq'), (19, 'Emily', 'emilymendelson14@gmail.com', '$2y$10$LGCcY9mrUaEpTvTV8n5X7u5D97T084VHZeFYbpERe3L.qvD8B6TTm'), (20, 'Essmandelbaum', 'Essmandelbaum@gmail.com', '$2y$10$dUB5Gm889qaIWNCm8jt9a.fTR5YSm2njfWQLKsJFNtm7q3mUwgLG6'), (21, 'test', 'test@gmail.ca', '$2y$10$zh/ZkHSrCc.LGWSatG0sFuTmOM3ipWGyjidqZIFt/EdqCKBNwTJX.'); -- -- Indexes for dumped tables -- -- -- Indexes for table `journal` -- ALTER TABLE `journal` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`idUsers`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `journal` -- ALTER TABLE `journal` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `idUsers` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
bf8f06124c60e1531ab16f9f8a63a53e255d9a9f
SQL
FeXyK/Authory
/CreateAuthorySchema.sql
UTF-8
2,885
3.203125
3
[]
no_license
CREATE DATABASE IF NOT EXISTS `authory` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; USE `authory`; -- MySQL dump 10.13 Distrib 8.0.22, for Win64 (x86_64) -- -- Host: 192.168.0.65 Database: authory -- ------------------------------------------------------ -- Server version 8.0.22-0ubuntu0.20.04.2 /*!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 */; /*!50503 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `account` -- DROP TABLE IF EXISTS `account`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `account` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL, `password` varchar(45) NOT NULL DEFAULT 'pass', PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `character` -- DROP TABLE IF EXISTS `character`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `character` ( `id` int NOT NULL AUTO_INCREMENT, `account_id` int NOT NULL, `name` varchar(30) NOT NULL, `level` int NOT NULL DEFAULT '1', `model` int NOT NULL DEFAULT '0', `experience` int NOT NULL DEFAULT '0', `map_index` int NOT NULL DEFAULT '0' COMMENT 'The map where this character exists', `position_x` decimal(6,2) NOT NULL DEFAULT '450.00', `position_z` decimal(6,2) NOT NULL DEFAULT '450.00', `health` int NOT NULL DEFAULT '50000', `mana` int NOT NULL DEFAULT '50000', PRIMARY KEY (`id`), UNIQUE KEY `character_name_UNIQUE` (`name`) ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2020-12-09 23:49:57
true
f5d765d587c4c372446d3e0574b42badf53bbacc
SQL
sknabniai/karbase
/Sungero.Parties/VersionData/2.5.18.0/Script/convert_after_mssql.sql
UTF-8
737
3.25
3
[]
no_license
-- Заполнить св-во КА "Эл. обмен" if exists(select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME='Sungero_Parties_ExchangeBoxes') and exists(select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME='Sungero_Parties_Counterparty') begin update counterparty set CanExchange = case when exists(select * from Sungero_Parties_ExchangeBoxes eBox where Status = 'Active' and counterparty.Id = eBox.Counterparty) then 'true' else 'false' end from Sungero_Parties_Counterparty counterparty where CanExchange is null end
true
2d6a3fa7f260607a20cb55180c96505f95387fe1
SQL
FThorson/just_practice
/SQLQuery7.sql
UTF-8
380
3.265625
3
[]
no_license
select count(InvoiceNumber) as NumInv ,SUM(InvoiceTotal) as TotBal from Invoices where InvoiceTotal - PaymentTotal - CreditTotal > 0 select 'After 9/1/2011' as SelDate ,count(*) as NumInv ,AVG(InvoiceTotal) as AvInv ,sum(InvoiceTotal) as Total ,MIN(InvoiceTotal) as LowInv ,MAX(InvoiceTotal) as MaxInv from Invoices where InvoiceDate > '9/1/2011'
true
f672cdd3df2203e175df3b86955a7523237ee497
SQL
Ariah-Group/Research
/db_scripts/main/KC-RELEASE-3_2-SCRIPT/mysql/constraints/KC_FK_NEGOTIATION_CUSTOM_DATA.sql
UTF-8
172
2.84375
3
[ "Apache-2.0", "ECL-2.0" ]
permissive
DELIMITER / ALTER TABLE NEGOTIATION_CUSTOM_DATA ADD CONSTRAINT FK_NEGOTIATION_CUSTOM_DATA FOREIGN KEY (CUSTOM_ATTRIBUTE_ID) REFERENCES CUSTOM_ATTRIBUTE(ID) / DELIMITER ;
true
c3123b9a1c4c8f150567ac5a49e775b0790796e4
SQL
zz2555/NeuroFlow-Data-Challenge
/Part2/SQL Problem2.sql
UTF-8
161
3.171875
3
[]
no_license
SELECT organization_name FROM Providers p1 LEFT JOIN Phq9 p2 ON p1.provider_id=p2.provider_id GROUP BY p1.organization_name ORDER BY AVG(p2.score) DESC LIMIT 5
true
1d0fa8e4c2da98198a6e5813210fa7b4b46b464f
SQL
teqonix/smartplugdatabug
/ouimeauxDBProject/ouimeauxDBProject/dw/Tables/dimStatusList.sql
UTF-8
651
2.703125
3
[]
no_license
CREATE TABLE [dw].[dimStatusList] ( [statusIK] BIGINT CONSTRAINT [DF_dimStatusList_statusIK] DEFAULT (NEXT VALUE FOR [dw].[dimStatusListIK]) NOT NULL, [statusNaturalKey] BIGINT NOT NULL, [statusLabel] NVARCHAR (255) NULL, [statusNumberRepresentation] INT NULL, [statusAddedDate] DATE NOT NULL, [recordEffectiveDate] DATE NOT NULL, [recordExpirationDate] DATE NULL, [isCurrent] BIT NULL, CONSTRAINT [PK_dimStatusList] PRIMARY KEY CLUSTERED ([statusIK] ASC) );
true
799f788ab75bd1267b2a7d5b5499ba11c7d441fa
SQL
mabr3/HackerRank
/SQL/BasicJoin/ContestLeaderboard.sql
UTF-8
272
4.4375
4
[]
no_license
SELECT h.hacker_id, h.name, SUM(max_s.sc) as S FROM Hackers h inner join (SELECT hacker_id, max(score) sc from Submissions GROUP BY challenge_id, hacker_id) max_s on h.hacker_id = max_s.hacker_id GROUP BY h.hacker_id, h.name HAVING S <>0 ORDER BY S desc, h.hacker_id asc
true
7d9ec72ff4327dc83f107ad3d68b547a46d2ccdc
SQL
keshaan/myrepo
/notebooks/Users/prasakumar@clearlightau.com/DIM_Consolidation_Group.sql
UTF-8
1,110
3.46875
3
[]
no_license
-- Databricks notebook source -- Drop table Dim Consolidation Group in Databricks /*Drop Table if exists pmfd_db.dim_consolidation_group */ -- COMMAND ---------- -- Create table Dim Consolidation Group in Databricks /*CREATE TABLE pmfd_db.dim_consolidation_group ( consolidation_group_unit_sk bigint NOT NULL, consolidation_group_code string NOT NULL , Consolidation_Group_Name string NOT NULL , Consolidation_Unit_Code string NOT NULL , Consolidation_Unit_Name string NOT NULL, Creation_Date Timestamp NOT NULL)*/ -- COMMAND ---------- -- Load Dim Consolidation Group in Databricks insert into table pmfd_db.dim_consolidation_group select row_number() over(order by trim(CONGRPCD))+(select max(consolidation_group_unit_sk) from pmfd_db.dim_consolidation_group),CONGRPCD,CONGRPNM,CONUNCD,CONUNNM from (select distinct trim(ConsolidationGroupCode_CONGRPCD) CONGRPCD, trim(ConsolidationGroupName_CONGRPNM) CONGRPNM, trim(ConsolidationUnitCode_CONUNCD) CONUNCD, trim(ConsolidationUnitName_CONUNNM) CONUNNM, current_date() from pmfd_db.Finance_Consolidated_Financials_full)
true
41f0aa26a424f62b06ab8555601b2c782528add9
SQL
mattfarrow1/7330-term-project
/mysql/SQLqueries.sql
UTF-8
7,726
4.28125
4
[]
no_license
use jeopardy; # Get the top 10 categories SELECT category, count(*) AS games FROM board GROUP BY category ORDER BY games DESC LIMIT 10; # Get the top 10 double Jeopardy locations SELECT subquery.rowcat, subquery.colcat, count(*) as count FROM ( SELECT board.clueid, board.doublejeop, location.rowcat, location.colcat FROM location LEFT JOIN board ON board.clueid = location.board_clueid WHERE board.doublejeop = 1 ) AS subquery GROUP BY subquery.rowcat, subquery.colcat ORDER BY count(*) DESC LIMIT 10; # What are the most common values of the first chosen clue in the game? SELECT score, count(*) AS games FROM board WHERE chosen = 1 GROUP BY score ORDER BY score LIMIT 10; #find Arthur Chu's contestant ID select * from players where firstname = 'Arthur' and lastname = 'Chu'; #8885 is normal jeopardy player id, and 9514 is tounament of champs id #what about Ken Jennings select * from players where firstname = 'Ken' and lastname = 'Jennings'; #1 is normal jeop id #661 2005 tounament of champs #7206 IBM/Watson games #9010 Battle of the Decades #12547 2019 all stars #13086 the greatest of all time games #find James H's contestant ID select * from players where firstname = 'James' and lastname = 'Holzhauer'; #12600 is normal player id #12983 2019 tournmanet of champs #13087 greatest of all time #only include their non-tournament IDs? #pull all contestants to perform word analysis on occupation or location select * from players; #pull all of Arthur Chu's games select * from players_has_episode where players_playerid IN (8885, 9514); #pull all of his scores select finalscore, ansRight, ansWrong, players.playerid, players.firstname from synopsis_has_players INNER JOIN synopsis on synopsis_has_players.synopsis_finalscoreid = synopsis.finalscoreid INNER JOIN players on synopsis_has_players.players_playerid = players.playerid where playerid IN (8885, 9514); #Top 5 players average & max scores for non-tournament games select players.firstname, players.lastname, round(avg(finalscore),1) AS average, max(finalscore) as max_score, round(avg(ansRight)) as avg_correct, round(avg(ansWrong)) as avg_incorrect, sum(ansRight) as total_correct, sum(ansWrong) as total_incorrect, count(*) as total_games from synopsis_has_players INNER JOIN synopsis on synopsis_has_players.synopsis_finalscoreid = synopsis.finalscoreid INNER JOIN players on synopsis_has_players.players_playerid = players.playerid group by playerid order by total_correct desc limit 10; #who has all time top correct answers select players.firstname, max(finalscore) as max_score, round(avg(ansRight)) as avg_correct, round(avg(ansWrong)) as avg_incorrect, sum(ansRight) as total_correct, sum(ansWrong) as total_incorrect from synopsis_has_players INNER JOIN synopsis on synopsis_has_players.synopsis_finalscoreid = synopsis.finalscoreid INNER JOIN players on synopsis_has_players.players_playerid = players.playerid group by playerid order by total_correct desc; #Ken Jenning's scores select finalscore, ansRight, ansWrong, players.playerid, players.firstname, synopsis.episode_gameid from synopsis_has_players INNER JOIN synopsis on synopsis_has_players.synopsis_finalscoreid = synopsis.finalscoreid INNER JOIN players on synopsis_has_players.players_playerid = players.playerid where playerid IN (1, 661, 7206, 9010, 12547, 13086) order by finalscore desc; #Ken Jenning's average answers right and wrong per game select avg(ansRight) as Avg_Right, avg(ansWrong) as Avg_Wrong, players.playerid, players.firstname from synopsis_has_players INNER JOIN synopsis on synopsis_has_players.synopsis_finalscoreid = synopsis.finalscoreid INNER JOIN players on synopsis_has_players.players_playerid = players.playerid where playerid IN (1, 661, 7206, 9010, 12547, 13086) order by finalscore desc; #global average select avg(ansRight) as Avg_Right, avg(ansWrong) as Avg_Wrong from synopsis; #double jeopardy per game select count(doublejeop), episode_gameid from board where doublejeop = 1 group by episode_gameid; #double jeopardy clue info select clueid, roundnum, category, clue, answer, episode_gameid from board where doublejeop = 1; #who got double jeopardy clue select board.clueid, category, clue, answer, players.playerid, players.firstname, players.lastname from board INNER JOIN doubles_has_scores on doubles_has_scores.clueid = board.clueid INNER JOIN players on players.playerid = doubles_has_scores.playerid where doublejeop = 1; #summarize totals by playerid, and show top 10 players select count(board.clueid) as double_jeop_count, players.playerid, players.firstname, players.lastname from board INNER JOIN doubles_has_scores on doubles_has_scores.clueid = board.clueid INNER JOIN players on players.playerid = doubles_has_scores.playerid where doublejeop = 1 GROUP BY playerid order by double_jeop_count desc limit 10; SELECT subquery.rowcat, subquery.colcat, count(*) as count_dj FROM ( SELECT board.clueid, board.doublejeop, location.rowcat, location.colcat FROM location LEFT JOIN board ON board.clueid = location.board_clueid WHERE board.doublejeop = 1 ) AS subquery GROUP BY subquery.rowcat, subquery.colcat ORDER BY count_dj DESC; SELECT board.clueid, board.doublejeop, location.rowcat, location.colcat FROM location LEFT JOIN board ON board.clueid = location.board_clueid WHERE board.doublejeop = 1; select count(board.clueid) as loc_count, players.playerid, players.firstname, players.lastname, location.rowcat, location.colcat from board INNER JOIN doubles_has_scores on doubles_has_scores.clueid = board.clueid INNER JOIN location on board.clueid = location.board_clueid INNER JOIN players on players.playerid = doubles_has_scores.playerid where doublejeop = 1 and players.playerid in (1, 12600, 861, 12824, 9037, 10171, 11663, 8885, 10911, 8522) group by playerid, rowcat, colcat order by playerid; #top locations overall between top ten players select count(board.clueid) as loc_count, location.rowcat, location.colcat from board INNER JOIN doubles_has_scores on doubles_has_scores.clueid = board.clueid INNER JOIN location on board.clueid = location.board_clueid INNER JOIN players on players.playerid = doubles_has_scores.playerid where doublejeop = 1 and players.playerid in (1, 12600, 861, 12824, 9037, 10171, 11663, 8885, 10911, 8522) group by rowcat, colcat order by loc_count desc; #min & max daily double wager select min(abs(double_score)) as minimum_wager, max(abs(double_score)) as max_wager from doubles_has_scores; #find most common daily double wager select abs(double_score), count(*) from doubles_has_scores group by abs(double_score) order by count(*) desc limit 1; #who has the top all time scores? select finalscore, players.firstname, players.lastname from synopsis inner join synopsis_has_players on synopsis_has_players.synopsis_finalscoreid = synopsis.finalscoreid inner join players on players.playerid = synopsis_has_players.players_playerid order by finalscore desc limit 10; #highest score for Ken Jennings select finalscore, players.firstname, players.lastname from synopsis inner join synopsis_has_players on synopsis_has_players.synopsis_finalscoreid = synopsis.finalscoreid inner join players on players.playerid = synopsis_has_players.players_playerid where players.firstname = 'Ken' and players.lastname = 'Jennings' order by finalscore desc limit 10; #get all game player info to perform winner analysis in R select finalscore, episode_gameid, finalscoreid, ansRight, ansWrong, players.firstname, players.lastname, players_playerid from synopsis inner join synopsis_has_players on synopsis_has_players.synopsis_finalscoreid = synopsis.finalscoreid inner join players on players.playerid = synopsis_has_players.players_playerid;
true
fd83e8e65e357652959cfc1bbe747556024da244
SQL
hs731/homephplearning
/CourseworkWebsite/mysql tables/users.sql
UTF-8
1,588
2.90625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.4.10.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Apr 20, 2019 at 05:52 PM -- Server version: 5.5.21 -- PHP Version: 5.6.18 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 utf8 */; -- -- Database: `hshakil` -- -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `username` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, `location` varchar(255) NOT NULL, `birthday` date NOT NULL, `favdrink` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `number` int(11) NOT NULL, `avatar` varchar(120) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`username`, `password`, `location`, `birthday`, `favdrink`, `email`, `number`, `avatar`) VALUES ('andy', 'coffee', 'Bradford', '1999-07-16', 'Pepsi', 'Andy@gmail.com', 792374383, 'beanie'), ('bobby', 'password1', 'London', '2000-03-03', 'Coke', 'bobby923@gmail.com', 792383218, 'dragon'), ('jack', '123', 'Bradford', '1999-05-21', 'Pepsi', 'jack321@gmail.com', 74639846, 'dragon'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
ea7140072854c0ff84030c584e023225b9e2d1f2
SQL
SunriseSoftVN/qlkh
/src/database/v.1.0.6.sql
UTF-8
353
2.78125
3
[]
no_license
ALTER TABLE `subtaskannualdetail` DROP `lastYear`; ALTER TABLE `subtaskannualdetail` DROP `currentYear`; ALTER TABLE `qlvt`.`subtaskannualdetail` ADD UNIQUE `sub_task_detail_annual_index` ( `taskDetailId` , `branchId` ); -- Fix bug set time on client when time on client is not correct. update `taskdetail` set `year` = 2012 WHERE `year` = 2013;
true
a60e9bcf126c4222524b75c4eb1d2d066c6aed62
SQL
escalantegc/mupum
/sql/20-09-2018.sql
UTF-8
1,444
3.5
4
[]
no_license
-- Table: public.cabecera_cuota_societaria -- DROP TABLE public.cabecera_cuota_societaria; CREATE TABLE public.cabecera_cuota_societaria ( idcabecera_cuota_societaria SERIAL NOT NULL, archivo bytea NOT NULL, periodo character(7), fecha_importacion date, idconcepto_liquidacion integer, CONSTRAINT cabecera_cuota_societaria_pkey PRIMARY KEY (idcabecera_cuota_societaria), CONSTRAINT cabecera_cuota_societaria_idconcepto_liquidacion_fkey FOREIGN KEY (idconcepto_liquidacion) REFERENCES public.concepto_liquidacion (idconcepto_liquidacion) MATCH SIMPLE ON UPDATE CASCADE ON DELETE RESTRICT ) WITH ( OIDS=FALSE ); ALTER TABLE public.cabecera_cuota_societaria OWNER TO postgres; -- Table: public.cuota_societaria -- DROP TABLE public.cuota_societaria; CREATE TABLE public.cuota_societaria ( idcuota_societaria serial NOT NULL , idpersona integer NOT NULL, idafiliacion integer NOT NULL, cargo character(6) NOT NULL, idconcepto_liquidacion integer NOT NULL, monto double precision NOT NULL, idcabecera_cuota_societaria integer, CONSTRAINT cuota_societaria_pkey PRIMARY KEY (idcuota_societaria), CONSTRAINT cuota_societaria_idconcepto_liquidacion_fkey FOREIGN KEY (idconcepto_liquidacion) REFERENCES public.concepto_liquidacion (idconcepto_liquidacion) MATCH SIMPLE ON UPDATE CASCADE ON DELETE RESTRICT ) WITH ( OIDS=FALSE ); ALTER TABLE public.cuota_societaria OWNER TO postgres;
true
fe06c8873cd01191c57e0c30f8bf0449a30b296c
SQL
DJAHIDDJ13/S4
/BDAplus/create_r_db2.sql
UTF-8
1,176
4.03125
4
[]
no_license
CREATE TABLE City ( city_id INT NOT NULL UNIQUE PRIMARY KEY, city_name VARCHAR(64) NOT NULL, NOC VARCHAR(3) NOT NULL ); CREATE TABLE CountryCode ( NOC VARCHAR(3) NOT NULL PRIMARY KEY, country_name VARCHAR(64) NOT NULL , ISOCode VARCHAR(2) NOT NULL ); CREATE TABLE Discipline ( discipline_id INT NOT NULL UNIQUE PRIMARY KEY, sport_name VARCHAR(64), discipline_name VARCHAR(64) ); CREATE TYPE Event_Gender_t AS ENUM ('W', 'M', 'X'); CREATE TABLE Event( event_id INT NOT NULL UNIQUE PRIMARY KEY, event_name VARCHAR(64), event_gender Event_Gender_t, discipline_id INT NOT NULL REFERENCES Discipline(discipline_id), edition INT, city_id INT NOT NULL REFERENCES City(city_id) ); CREATE TYPE Gender_t AS ENUM ('Women', 'Men'); CREATE TABLE Athlete( athlete_id INT NOT NULL UNIQUE PRIMARY KEY, athlete_name VARCHAR(64) NOT NULL, athlete_gender Gender_t ); CREATE TYPE Medal_t AS ENUM ('Gold', 'Silver', 'Bronze'); CREATE TABLE Medal ( athlete_id INT NOT NULL REFERENCES Athlete(athlete_id), event_id INT NOT NULL REFERENCES Event(event_id), represent_NOC VARCHAR(3) REFERENCES CountryCode(NOC), medal_type Medal_t );
true
ba661fc606911f25ed0e2949448499c645065f83
SQL
MalvikaBodh/Data-Engineering
/Project 5: Data Pipeline/dags/create_tables.sql
UTF-8
1,842
3.328125
3
[]
no_license
CREATE TABLE IF NOT EXISTS public.staging_events ( artist varchar, auth varchar, firstname varchar, gender varchar, iteminsession integer, lastname varchar, length float, level varchar, location varchar, method varchar, page varchar, registration bigint, sessionid integer, song varchar, status integer, ts bigint, useragent varchar, userid integer ); CREATE TABLE IF NOT EXISTS public.staging_songs ( num_songs integer, artist_id varchar, artist_latitude NUMERIC (9, 5), artist_longitude NUMERIC (9, 5), artist_location varchar, artist_name varchar, song_id varchar, title varchar, duration float, year integer ); CREATE TABLE IF NOT EXISTS public.songplay (songplay_id varchar PRIMARY KEY, start_time TIMESTAMP distkey, userid integer, level varchar , song_id varchar sortkey, artist_id varchar, session_id varchar , location varchar, useragent text); CREATE TABLE IF NOT EXISTS public.users (userid integer PRIMARY KEY sortkey, firstname varchar, lastname varchar, gender varchar, level varchar); CREATE TABLE IF NOT EXISTS public.songs (song_id varchar PRIMARY KEY sortkey, title varchar , artist_id varchar , year integer , duration float); CREATE TABLE IF NOT EXISTS public.artists (artist_id varchar PRIMARY KEY sortkey, artist_name varchar, artist_location varchar, artist_latitude NUMERIC (9, 5), artist_longitude NUMERIC (9, 5)); CREATE TABLE IF NOT EXISTS public.time (start_time timestamp PRIMARY KEY NOT NULL sortkey, hour integer NOT NULL , day integer NOT NULL , week integer NOT NULL , month integer NOT NULL , year integer NOT NULL , weekday integer NOT NULL) diststyle all;
true
c685e0697e0fa36bc74ee939f73ef8ec87652110
SQL
minji0320/Algorithm_for_CodingTest
/Sehoon/Programmers/SQL/최댓값 구하기.sql
UTF-8
1,368
3.796875
4
[]
no_license
-- 문제 설명 -- ANIMAL_INS 테이블은 동물 보호소에 들어온 동물의 정보를 담은 테이블입니다. ANIMAL_INS 테이블 구조는 다음과 같으며, ANIMAL_ID, ANIMAL_TYPE, DATETIME, INTAKE_CONDITION, NAME, SEX_UPON_INTAKE는 각각 동물의 아이디, 생물 종, 보호 시작일, 보호 시작 시 상태, 이름, 성별 및 중성화 여부를 나타냅니다. -- -- NAME TYPE NULLABLE -- ANIMAL_ID VARCHAR(N) FALSE -- ANIMAL_TYPE VARCHAR(N) FALSE -- DATETIME DATETIME FALSE -- INTAKE_CONDITION VARCHAR(N) FALSE -- NAME VARCHAR(N) TRUE -- SEX_UPON_INTAKE VARCHAR(N) FALSE -- 가장 최근에 들어온 동물은 언제 들어왔는지 조회하는 SQL 문을 작성해주세요. -- -- 예시 -- 예를 들어 ANIMAL_INS 테이블이 다음과 같다면 -- -- ANIMAL_ID ANIMAL_TYPE DATETIME INTAKE_CONDITION NAME SEX_UPON_INTAKE -- A399552 Dog 2013-10-14 15:38:00 Normal Jack Neutered Male -- A379998 Dog 2013-10-23 11:42:00 Normal Disciple Intact Male -- A370852 Dog 2013-11-03 15:04:00 Normal Katie Spayed Female -- A403564 Dog 2013-11-18 17:03:00 Normal Anna Spayed Female -- 가장 늦게 들어온 동물은 Anna이고, Anna는 2013-11-18 17:03:00에 들어왔습니다. 따라서 SQL문을 실행하면 다음과 같이 나와야 합니다. -- -- 시간 -- 2013-11-18 17:03:00 SELECT MAX(DATETIME) FROM ANIMAL_INS ORDER BY DATETIME;
true
5b36807973cfffefeaf3016ffd6e64553d5ecca1
SQL
tuanhiep/deanSpring
/src/main/resources/initial.data/initialize_deanSpring.sql
UTF-8
3,620
3.515625
4
[]
no_license
-- 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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; -- ----------------------------------------------------- -- Schema DeanSpring -- ----------------------------------------------------- DROP SCHEMA IF EXISTS `DeanSpring` ; -- ----------------------------------------------------- -- Schema DeanSpring -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `DeanSpring` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ; USE `DeanSpring` ; -- ----------------------------------------------------- -- Table `DeanSpring`.`User` -- ----------------------------------------------------- DROP TABLE IF EXISTS `DeanSpring`.`User` ; CREATE TABLE IF NOT EXISTS `DeanSpring`.`User` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, `email` VARCHAR(45) NOT NULL, `phone` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `DeanSpring`.`Department` -- ----------------------------------------------------- DROP TABLE IF EXISTS `DeanSpring`.`Department` ; CREATE TABLE IF NOT EXISTS `DeanSpring`.`Department` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(45) NOT NULL, `email` VARCHAR(45) NOT NULL, `phone` VARCHAR(45) NULL, PRIMARY KEY (`id`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `DeanSpring`.`Request` -- ----------------------------------------------------- DROP TABLE IF EXISTS `DeanSpring`.`Request` ; CREATE TABLE IF NOT EXISTS `DeanSpring`.`Request` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `course` VARCHAR(45) NOT NULL, `section` VARCHAR(45) NOT NULL, `size` VARCHAR(45) NOT NULL, `de` INT NULL, `instructor` VARCHAR(45) NOT NULL, `amount` VARCHAR(45) NOT NULL, `motivation` TINYTEXT NULL, `commitment` TINYTEXT NULL, `note` TEXT NULL, `priority` VARCHAR(45) NULL, `date_created` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, `date_revision` TIMESTAMP NULL, `Department_id` INT UNSIGNED NOT NULL, PRIMARY KEY (`id`), INDEX `fk_Request_Department1_idx` (`Department_id` ASC) VISIBLE, CONSTRAINT `fk_Request_Department1` FOREIGN KEY (`Department_id`) REFERENCES `DeanSpring`.`Department` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `DeanSpring`.`User_has_Department` -- ----------------------------------------------------- DROP TABLE IF EXISTS `DeanSpring`.`User_has_Department` ; CREATE TABLE IF NOT EXISTS `DeanSpring`.`User_has_Department` ( `User_id` INT UNSIGNED NOT NULL, `Department_id` INT UNSIGNED NOT NULL, PRIMARY KEY (`User_id`, `Department_id`), INDEX `fk_User_has_Department_Department1_idx` (`Department_id` ASC) VISIBLE, INDEX `fk_User_has_Department_User1_idx` (`User_id` ASC) VISIBLE, CONSTRAINT `fk_User_has_Department_User1` FOREIGN KEY (`User_id`) REFERENCES `DeanSpring`.`User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_User_has_Department_Department1` FOREIGN KEY (`Department_id`) REFERENCES `DeanSpring`.`Department` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
true
1bb79d14fa9dbec4774e88defc3ba429cc784bd3
SQL
wfyson/Disaggregator2
/extensions/dbschema.sql
UTF-8
8,916
3.046875
3
[]
no_license
-- MySQL dump 10.13 Distrib 5.5.46, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: disaggregatordb -- ------------------------------------------------------ -- Server version 5.5.46-0ubuntu0.14.04.2 /*!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 utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `component` -- DROP TABLE IF EXISTS `component`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `component` ( `ComponentID` int(11) NOT NULL AUTO_INCREMENT, `DescriptorID` int(11) NOT NULL, `DocumentID` int(11) DEFAULT NULL, `Source` varchar(45) DEFAULT NULL, `Security` enum('User','Contributors','Public') NOT NULL, PRIMARY KEY (`ComponentID`) ) ENGINE=InnoDB AUTO_INCREMENT=335 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `componentvalue` -- DROP TABLE IF EXISTS `componentvalue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `componentvalue` ( `ComponentValueID` int(11) NOT NULL AUTO_INCREMENT, `Value` int(11) NOT NULL, `ComponentID` int(11) NOT NULL, `FieldID` int(11) NOT NULL, PRIMARY KEY (`ComponentValueID`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `contributor` -- DROP TABLE IF EXISTS `contributor`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `contributor` ( `ContributorID` int(11) NOT NULL AUTO_INCREMENT, `GivenName` varchar(64) NOT NULL, `FamilyName` varchar(64) NOT NULL, `UserID` int(11) DEFAULT NULL, `Orcid` varchar(19) DEFAULT NULL, PRIMARY KEY (`ContributorID`) ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `contributorvalue` -- DROP TABLE IF EXISTS `contributorvalue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `contributorvalue` ( `ContributorValueID` int(11) NOT NULL AUTO_INCREMENT, `Value` int(11) NOT NULL, `ComponentID` int(11) NOT NULL, `FieldID` int(11) NOT NULL, PRIMARY KEY (`ContributorValueID`) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `descriptor` -- DROP TABLE IF EXISTS `descriptor`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `descriptor` ( `DescriptorID` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(45) NOT NULL, `Description` varchar(255) NOT NULL, `UserID` int(11) NOT NULL, `PreviewID` int(11) DEFAULT NULL, `NamespaceID` int(11) DEFAULT NULL, `Class` varchar(255) DEFAULT NULL, PRIMARY KEY (`DescriptorID`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `descriptorfield` -- DROP TABLE IF EXISTS `descriptorfield`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `descriptorfield` ( `DescriptorFieldID` int(11) NOT NULL AUTO_INCREMENT, `DescriptorID` int(11) NOT NULL, `FieldID` int(11) NOT NULL, PRIMARY KEY (`DescriptorFieldID`) ) ENGINE=InnoDB AUTO_INCREMENT=89 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `document` -- DROP TABLE IF EXISTS `document`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `document` ( `DocumentID` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(45) NOT NULL, `Filepath` varchar(255) DEFAULT NULL, `UserID` varchar(255) NOT NULL, `Security` enum('User','Contributors','Public') NOT NULL, `Source` varchar(45) NOT NULL, `ParentID` int(11) DEFAULT NULL, PRIMARY KEY (`DocumentID`) ) ENGINE=InnoDB AUTO_INCREMENT=151 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `field` -- DROP TABLE IF EXISTS `field`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `field` ( `FieldID` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(64) NOT NULL, `Type` enum('Text','File','Component','Contributor') NOT NULL, `Mandatory` tinyint(1) NOT NULL, `Multi` tinyint(1) NOT NULL, `DescriptorType` int(11) DEFAULT NULL, `NamespaceID` int(11) DEFAULT NULL, `Property` varchar(255) DEFAULT NULL, PRIMARY KEY (`FieldID`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `filevalue` -- DROP TABLE IF EXISTS `filevalue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `filevalue` ( `FileValueID` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(45) NOT NULL, `Value` varchar(255) NOT NULL, `ComponentID` int(11) NOT NULL, `FieldID` int(11) NOT NULL, PRIMARY KEY (`FileValueID`) ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `namespace` -- DROP TABLE IF EXISTS `namespace`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `namespace` ( `NamespaceID` int(11) NOT NULL AUTO_INCREMENT, `NamespaceURI` varchar(2083) NOT NULL, `Title` varchar(45) NOT NULL, PRIMARY KEY (`NamespaceID`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `person` -- DROP TABLE IF EXISTS `person`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `person` ( `UserID` int(11) NOT NULL AUTO_INCREMENT, `Username` varchar(45) NOT NULL, `Email` varchar(255) NOT NULL, `Password` varchar(255) DEFAULT NULL, PRIMARY KEY (`UserID`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `scanner` -- DROP TABLE IF EXISTS `scanner`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `scanner` ( `ScannerID` int(11) NOT NULL AUTO_INCREMENT, `ClassName` varchar(45) NOT NULL, `DescriptorID` int(11) NOT NULL, PRIMARY KEY (`ScannerID`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `textvalue` -- DROP TABLE IF EXISTS `textvalue`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `textvalue` ( `TextValueID` int(11) NOT NULL AUTO_INCREMENT, `Value` text NOT NULL, `ComponentID` int(11) NOT NULL, `FieldID` int(11) NOT NULL, PRIMARY KEY (`TextValueID`) ) ENGINE=InnoDB AUTO_INCREMENT=75 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `user` -- DROP TABLE IF EXISTS `user`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `user` ( `UserID` int(11) NOT NULL AUTO_INCREMENT, `Username` varchar(45) NOT NULL, `Email` varchar(255) NOT NULL, `Password` varchar(255) NOT NULL, PRIMARY KEY (`UserID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2015-12-10 17:43:10
true
7302d1ea6c43929c7703a320c8152ea635a8fe5d
SQL
guitarmind/datasci_course_materials
/assignment2/prob3_i.sql
UTF-8
1,001
3.921875
4
[]
no_license
CREATE VIEW search_view AS SELECT * FROM frequency UNION SELECT 'q' AS docid, 'washington' AS term, 1 AS count UNION SELECT 'q' AS docid, 'taxes' AS term, 1 AS count UNION SELECT 'q' AS docid, 'treasury' AS term, 1 AS count; SELECT sum(result) AS sim FROM ( SELECT f1.docid AS docid1, f1.term AS term1,f1.count, f2.docid AS docid2, f2.term AS term2, f2.count, (f1.count * f2.count) AS result FROM search_view f1, search_view f2 WHERE f1.term = f2.term AND f1.docid = 'q' AND f2.docid != 'q' GROUP BY f2.docid ORDER BY f2.docid, result DESC ) R GROUP BY docid2 ORDER BY sim DESC LIMIT 1; --SELECT R.term2, sum(R.result) AS similarity FROM ( --SELECT f1.docid, f1.term AS term1, f1.count, f2.docid AS simDocId, f2.term AS term2, f2.count, (f1.count * f2.count) AS result --FROM search_view f1, search_view f2 --WHERE f1.term = f2.term --AND f1.docid = 'q' AND f2.docid != 'q' --GROUP BY f2.docid, f2.term --) R --GROUP BY R.term2 --ORDER BY similarity DESC --LIMIT 100;
true
54553a7887991c2705af33b88e50a5f1f3888923
SQL
PranjitGautam/DBMS-Project
/after_discharge.sql
UTF-8
654
2.921875
3
[]
no_license
-- -- Script was generated by Devart dbForge Studio 2020 for MySQL, Version 9.0.470.0 -- Product home page: http://www.devart.com/dbforge/mysql/studio -- Script date 07-12-2020 22:46:07 -- Server version: 10.4.17 -- Client version: 4.1 -- Please backup your database before running this script -- SET NAMES 'utf8'; -- -- Set default database -- USE quarantine; DELIMITER $$ -- -- Create trigger `trigger1` -- CREATE DEFINER = 'root'@'localhost' TRIGGER after_discharge AFTER DELETE ON quarantined_person FOR EACH ROW BEGIN UPDATE allotment SET Available=1 WHERE Room_No=OLD.Room_Number; END $$ DELIMITER ;
true
e1cdf6dd2608b3c50fd546baf717cb94e543eddb
SQL
tranquiliza/RemoteLabels
/RemoteLabels.Database/Procedures/GetLatestPositionForUser.sql
UTF-8
247
3.296875
3
[]
no_license
CREATE PROCEDURE [Core].[GetLatestPositionForUser] @username NVARCHAR(50) AS BEGIN SELECT TOP (1) [Latitude], [Longitude], [Altitude], [Timestamp], [Username] FROM [Core].[Position] WHERE Username = @username ORDER BY [Timestamp] DESC END
true
6a75c66a73e1850c23bbc752924b9f89d845d4b1
SQL
Rajagunasekaran/Code-Backup
/NEW PROJECT SQL/SAMPLE/SP_MIG_CONFIG_INSERT.sql
UTF-8
6,197
2.609375
3
[]
no_license
-- version:1.5 -- sdate:18/06/2014 -- edate:18/06/2014 -- issue:805 --commentno#26,28 --desc:added cgn_id in ocbc_configuration(78,79,80) --done by:RL -- version:1.4 -- sdate:12/06/2014 -- edate:12/06/2014 -- issue:598 --commentno#63 --desc:removed left join queries --done by:RL & dhivya -- version:1.3 -- sdate:09/06/2014 -- edate:09/06/2014 -- issue:566 --comment no#12 --desc:IMPLEMENTED ROLLBACK AND COMMIT --done by:DHIVYA -- version:1.2 -- sdate:23/05/2014 -- edate:23/05/2014 -- issue:765 --comment no#157 --desc:ADDED CGN_ID 76 IN CUSTOMER CONFIGURATION TABLE --done by:RL -- version:1.1 -- sdate:12/05/2014 -- edate:12/05/2014 -- issue:765 --desc:changed insert query order for expense_configuration --COMMENTNO#110 --done by:RL -- version:1.0 -- sdate:08/05/2014 -- edate:08/05/2014 -- issue:765 --desc:added 1 insert query for insert values in expense configuration table --COMMENTNO#110 --done by:RL -- version:0.9 -- sdate:10/04/2014 -- edate:10/04/2014 -- issue:765 --desc:added SCDB 1/4/2014 TIME STAMP FOR ALL SS RECORDS --done by:RL -- version:0.8 --sdate:01/04/2014 --edate:01/04/2014 --issue:765 --commentno#53 --desc:SPLIT THE CONFIG MIG SP INTO 4 PART. --dONEBY:RL -- version:0.7 --sdate:28/03/2013 --edate:28/03/2014 --issue:783 --desc:changed ALL FOREIGN KEY REFERENCES TABLE SHOULD IN DESTINATION SCHEMA --doneby:RL -- VER:0.6 STARTDATE:28/03/2014 ENDDATE:28/03/2014 ISSUENO:783 DESC:CHANGED THE SP:SP_MIG_CONFIG_INSERT REMOVED THE DESTINATION SCHEMA IN POST_AUDIT_HISTORY DONE BY:LALITHA -- VER:0.5 STARTDATE:25/03/2014 ENDDATE:25/03/2014 ISSUENO:765 COMMENTNO:#8 DESC:CHANGED THE SP:SP_MIG_CONFIG_INSERT CHANGED THE SCHEMA FOR INSERTION IN POST AUDIT HISTORY AND UPDATION IN PRE AUDIT SUB PROFILE DONE BY:LALITHA -- version:0.4 -- sdate:20/03/2014 -- edate:22/03/2014 -- issue:765 -- desc:Changed the SP:SP_MIG_CONFIG_INSERT As prepared stmt for dynamic running purpose --Doneby:Lalitha -- version:0.3 -- sdate:17/03/2014 -- edate:17/03/2014 -- issue:765 -- desc:droped temp table -- doneby:RL -- version:0.2 -- sdate:25/02/2014 -- edate:25/02/2014 -- issue:750 -- desc:getting userstamp n time stamp from db & userstamp changed as uld_id -- doneby:RL -- version:0.1 -- sdate:20/02/2014 -- edate:21/02/2014 -- issue:750 -- desc:Implementing audit table insert -- doneby:RL DROP PROCEDURE IF EXISTS SP_MIG_CONFIG_INSERT1; CREATE PROCEDURE SP_MIG_CONFIG_INSERT1(IN SOURCESCHEMA VARCHAR(40),IN DESTINATIONSCHEMA VARCHAR(40),IN MIGUSERSTAMP VARCHAR(50)) BEGIN DECLARE START_TIME TIME; DECLARE END_TIME TIME; DECLARE DURATION TIME; DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN ROLLBACK; END; START TRANSACTION; SET FOREIGN_KEY_CHECKS=0; SET @LOGIN_ID=(SELECT CONCAT('SELECT ULD_ID INTO @ULDID FROM ',DESTINATIONSCHEMA,'.USER_LOGIN_DETAILS WHERE ULD_LOGINID=','"',MIGUSERSTAMP,'"')); PREPARE LOGINID_STMT FROM @LOGIN_ID; EXECUTE LOGINID_STMT; SET START_TIME = (SELECT CURTIME()); SET @DROP_CUSTOMER_CONFIGURATION=(SELECT CONCAT('DROP TABLE IF EXISTS ',DESTINATIONSCHEMA,'.CUSTOMER_CONFIGURATION')); PREPARE DROP_CUSTOMER_CONFIGURATIONSTMT FROM @DROP_CUSTOMER_CONFIGURATION; EXECUTE DROP_CUSTOMER_CONFIGURATIONSTMT; SET @CREATE_CUSTOMER_CONFIGURATION=(SELECT CONCAT('CREATE TABLE ',DESTINATIONSCHEMA,'.CUSTOMER_CONFIGURATION( CCN_ID INTEGER NOT NULL AUTO_INCREMENT, CGN_ID INTEGER NOT NULL, CCN_DATA TEXT NOT NULL, CCN_INITIALIZE_FLAG CHAR(1) NULL, ULD_ID INTEGER(2) NOT NULL, CCN_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY(CCN_ID),FOREIGN KEY(CGN_ID) REFERENCES ',DESTINATIONSCHEMA,'.CONFIGURATION(CGN_ID), FOREIGN KEY(ULD_ID) REFERENCES ',DESTINATIONSCHEMA,'.USER_LOGIN_DETAILS(ULD_ID))')); PREPARE CREATE_CUSTOMER_CONFIGURATION_STMT FROM @CREATE_CUSTOMER_CONFIGURATION; EXECUTE CREATE_CUSTOMER_CONFIGURATION_STMT; SET @INSERT_CUSTOMER_CONFIGURATION=(SELECT CONCAT('INSERT INTO ',DESTINATIONSCHEMA,'.CUSTOMER_CONFIGURATION(CCN_DATA,CGN_ID,CCN_INITIALIZE_FLAG,ULD_ID,CCN_TIMESTAMP) SELECT CSQL.DATA,CSQL.CGN_ID,CSQL.INITIALIZE_FLAG,ULD.ULD_ID,CSQL.TIMESTAMP FROM ',SOURCESCHEMA,'.CONFIG_SQL_FORMAT CSQL, ',DESTINATIONSCHEMA,'.USER_LOGIN_DETAILS ULD WHERE ULD.ULD_LOGINID = CSQL.USER_STAMP AND CGN_ID IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,33,39,47,50,53,54,75,76) AND CSQL.DATA IS NOT NULL ORDER BY CSQL.ID')); PREPARE INSERT_CUSTOMER_CONFIGURATION_STMT FROM @INSERT_CUSTOMER_CONFIGURATION; EXECUTE INSERT_CUSTOMER_CONFIGURATION_STMT; SET END_TIME = (SELECT CURTIME()); SET DURATION=(SELECT TIMEDIFF(END_TIME,START_TIME)); SET @COUNTCUSTOMERCONFIGURATIONSQLFORMAT=(SELECT CONCAT('SELECT COUNT(DATA) INTO @COUNT_CUSTOMER_CONFIGURATION_SQL_FORMAT FROM ',SOURCESCHEMA,'.CONFIG_SQL_FORMAT WHERE DATA IS NOT NULL AND CGN_ID IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,33,39,47,50,53,54,75,76)')); PREPARE COUNTCUSTOMERCONFIGURATIONSQLFORMATSTMT FROM @COUNTCUSTOMERCONFIGURATIONSQLFORMAT; EXECUTE COUNTCUSTOMERCONFIGURATIONSQLFORMATSTMT; SET @COUNTSPLITINGCUSTOMERCONFIGURATION=(SELECT CONCAT('SELECT COUNT(*) INTO @COUNT_SPLITING_CUSTOMER_CONFIGURATION FROM ',DESTINATIONSCHEMA,'.CUSTOMER_CONFIGURATION')); PREPARE COUNTSPLITINGCUSTOMERCONFIGURATIONSTMT FROM @COUNTSPLITINGCUSTOMERCONFIGURATION; EXECUTE COUNTSPLITINGCUSTOMERCONFIGURATIONSTMT; SET @REJECTION_COUNT=(@COUNT_CUSTOMER_CONFIGURATION_SQL_FORMAT-@COUNT_SPLITING_CUSTOMER_CONFIGURATION); SET @POSTAPID= (SELECT POSTAP_ID FROM POST_AUDIT_PROFILE WHERE POSTAP_DATA='CUSTOMER_CONFIGURATION'); SET @PREASPID = (SELECT PREASP_ID FROM PRE_AUDIT_SUB_PROFILE WHERE PREASP_DATA='CUSTOMER_CONFIGURATION'); SET @PREAMPID = (SELECT PREAMP_ID FROM PRE_AUDIT_MAIN_PROFILE WHERE PREAMP_DATA='CONFIGURATION'); SET @DUR=DURATION; UPDATE PRE_AUDIT_SUB_PROFILE SET PREASP_NO_OF_REC=@COUNT_CUSTOMER_CONFIGURATION_SQL_FORMAT WHERE PREASP_DATA='CUSTOMER_CONFIGURATION'; INSERT INTO POST_AUDIT_HISTORY(POSTAP_ID,POSTAH_NO_OF_REC,PREASP_ID,PREAMP_ID,POSTAH_DURATION,POSTAH_NO_OF_REJ,ULD_ID)VALUES (@POSTAPID,@COUNT_SPLITING_CUSTOMER_CONFIGURATION,@PREASPID,@PREAMPID,@DUR,@REJECTION_COUNT,@ULDID); SET FOREIGN_KEY_CHECKS = 1; COMMIT; END; CALL SP_MIG_CONFIG_INSERT1(SOURCESCHEMA,DESTINATIONSCHEMA,MIGUSERSTAMP);
true
f6dddd1f186345efb81e86e8b2051f5148c6f8eb
SQL
SahilGogna/SQL-Basics
/SQL class/sahilgogna_simulation.sql
UTF-8
2,117
4.125
4
[]
no_license
-- Design the relational model E-R -- Be sure all the tables are in the three normal forms -- Create relationships between tables -- Identify primary keys and foreign keys CREATE TABLE Member( code VARCHAR(5), first_name VARCHAR(20), last_name VARCHAR(20), phone VARCHAR(10), city VARCHAR(15), CONSTRAINT pk PRIMARY KEY(code) ); CREATE TABLE MOTORCYCLE( motonum VARCHAR(10), type_moto VARCHAR(10), moto_description VARCHAR(10), color VARCHAR(10), price currency, CONSTRAINT pk PRIMARY KEY(motonum) ); CREATE TABLE MemMoto( code VARCHAR(5), motonum VARCHAR(10), date_rented DATE, CONSTRAINT pk PRIMARY KEY(code, motonum, date_rented), CONSTRAINT fk_code FOREIGN KEY(code) REFERENCES Member(code), CONSTRAINT fk_motonum FOREIGN KEY(motonum) REFERENCES MemMoto(motonum) ); -- Insert data inside tables (member , motorcycle) and for the resulting table insert 2 records of your choice by respecting inserting order INSERT INTO Member VALUES ("RicP","Rick","Prince","(514)333-2244","Montréal"), ("IsaC","Isa","Chevalier","(514)556-7788","Montréal"), ("LivD","Livy","Duc","(514)678-5544","Montréal"), ("LynB","Lyne","Bella","(450)456-7720","Montréal"); INSERT INTO MOTORCYCLE VALUES ("MOTO001","Italien","ATALA","Red",100), ("MOTO002","Deca","BTWIN","Black",225), ("MOTO003","Italien","Suisse","White",400), ("MOTO004","Italien","Japonais","Black",200); INSERT INTO MemMoto VALUES ("RicP","MOTO001","21-06-2017"), ("IsaC","MOTO001","22-06-2017"); -- Add the field cellphone to the member table, define the datatype as number ALTER TABLE Member ADD cellphone number; -- Extract the information of all the motorcycles with the color black. SELECT * FROM MOTORCYCLE WHERE color ="Black"; -- Extract the id and the type of the motorcycle that the description started by J SELECT motonum ,type_moto from MOTORCYCLE WHERE moto_description LIKE "J%";
true
30f36649645c6ad255417fc515b5ffda0412559b
SQL
EdwinVanRooij/yakuza-general
/source/sql/procedures/p_wipe_table.sql
UTF-8
1,190
4.40625
4
[]
no_license
-- -- UNSAFE - THIS PROCEDURE WIPES A TABLE PERMANENTLY -- -- Trigger DDL Statements DELIMITER $$ -- Drop the previously made procedure DROP PROCEDURE IF EXISTS p_wipe_table $$ -- Create the procedure CREATE PROCEDURE p_wipe_table (IN p_table VARCHAR(100)) -- Start the procedure BEGIN -- Variable to count rows affected DECLARE rows_affected INT; -- Prepare the query string set @query1 = CONCAT('delete from ', p_table, '; '); set @query2 = CONCAT('ALTER TABLE ', p_table ,' AUTO_INCREMENT=1;'); -- Allow to delete whole tables SET SQL_SAFE_UPDATES = 0; -- Prepare executing the actual query PREPARE stmt1 FROM @query1; PREPARE stmt2 FROM @query2; -- Execute the statement EXECUTE stmt1; -- Get the rows affected right after delete statement SET rows_affected = ROW_COUNT(); -- Execute alter table to set AI back to 1 EXECUTE stmt2; -- Remove the variable DEALLOCATE PREPARE stmt1; DEALLOCATE PREPARE stmt2; -- Set it back to it's previous state SET SQL_SAFE_UPDATES = 1; -- Display the amount of rows selected if at least one was affected by the delete query IF(rows_affected > 0) THEN select CONCAT(rows_affected, ' in ', p_table) as 'Rows affected'; END IF; END $$ DELIMITER ;
true
530a2711ff7066affad14bda1e3f9efc47418082
SQL
nataliajanssen/Labs_Ironhack
/SQL/lab_sql6.sql
UTF-8
2,598
4.71875
5
[]
no_license
USE sakila; -- 1. Write a query to display for each store its store ID, city, and country. SELECT s.store_id,c.city,co.country FROM sakila.store s JOIN sakila.address a USING (address_id) JOIN sakila.city c USING (City_id) JOIN sakila.country co USING (Country_id); -- 2. Write a query to display how much business, in dollars, each store brought in. SELECT s.store_id, SUM(p.amount) as dollars FROM sakila.staff s JOIN sakila.payment p USING (staff_id) GROUP BY s.store_id; -- 3. Which film categories are longest? SELECT fc.category_id, c.name, AVG(f.length) AS avg_duration FROM sakila.film f JOIN sakila.film_category fc USING (film_id) JOIN sakila.category c USING (category_id) GROUP BY category_id ORDER BY avg_duration DESC LIMIT 1; -- 4. Display the most frequently rented movies in descending order. SELECT f.film_id, f.title,COUNT(r.rental_id) AS rental_times FROM sakila.rental r JOIN sakila.inventory i USING (inventory_id) JOIN sakila.film f USING (film_id) GROUP BY f.film_id ORDER BY rental_times DESC; -- 5. List the top five genres in gross revenue in descending order. SELECT c.category_id, c.name, SUM(p.amount) AS gross_revenue FROM sakila.category c JOIN sakila.film_category fc USING(category_id) JOIN sakila.inventory i USING(film_id) JOIN sakila.rental r USING (inventory_id) JOIN sakila.payment p USING (rental_id) GROUP BY c.category_id ORDER BY gross_revenue DESC LIMIT 5; -- 6. Is "Academy Dinosaur" available for rent from Store 1? SELECT store_id, f.title, COUNT(store_id) AS Num_film FROM store JOIN sakila.inventory i USING (store_id) JOIN sakila.film f USING(film_id) GROUP BY f.title, store_id HAVING f.title = 'Academy Dinosaur'; -- 7. Get all pairs of actors that worked together. select f3.title AS Title_of_the_Film,CONCAT(a.first_name,' ', a.last_name, '/', a2.first_name, a2.last_name) AS Actors from sakila.film_actor AS f1 join sakila.film_actor AS f2 oN (f1.film_id = f2.film_id) AND (f1.actor_id <> f2.actor_id) JOIN sakila.film as f3 ON (f1.film_id = f3.film_id) JOIN SAKILA.ACTOR AS a ON a.actor_id =f1.actor_id JOIN SAKILA.ACTOR AS a2 ON a2.actor_id =f2.actor_id ORDER BY f1.film_id ASC; -- 8. Get all pairs of customers that have rented the same film more than 3 times. select concat(c.first_name, ' ',c.last_name) as name,count(r.rental_id) from sakila.rental r inner join sakila.customer c on r.customer_id = c.customer_id inner join sakila.inventory i on r.inventory_id = i.inventory_id inner join sakila.film f on i.film_id = f.film_id group by concat(c.first_name, ' ',c.last_name) having count(r.rental_id) >= 3;
true
9fabae5e06cffbda619be2685097f583400433a0
SQL
marcos-goes/casadocodigo-nodejs
/cdc.sql
UTF-8
2,590
3.015625
3
[]
no_license
-- MySQL dump 10.13 Distrib 5.7.16, for Linux (x86_64) -- -- Host: 0.0.0.0 Database: casadocodigo -- ------------------------------------------------------ -- Server version 5.7.17 /*!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 utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `livros` -- DROP TABLE IF EXISTS `livros`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `livros` ( `id` int(11) NOT NULL AUTO_INCREMENT, `titulo` varchar(255) DEFAULT NULL, `descricao` text, `preco` decimal(10,2) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `livros` -- LOCK TABLES `livros` WRITE; /*!40000 ALTER TABLE `livros` DISABLE KEYS */; INSERT INTO `livros` VALUES (1,'Comecando com Node.JS','Livro introdutorio de Node.JS',39.90),(2,'Comecando com JavaScript','Livro introdutorio de JavaScript',49.90),(3,'Comecando com Express','Livro introdutorio sobre Express',46.90),(4,'Entendendo Java','Isso nao é pra qualquer um...',125.36),(5,'1808','Livro de história',24.89),(6,'1808','Livro de história',24.89),(7,'1889','Outro livro de história',35.90),(8,'Hibernate','Gravando dados com ORM',59.65),(9,'Ruby on Rails','Rails from Hell',85.32),(10,'Angular JS','JS ',85.21),(11,'novo Livrao','descricao do Livrao',87.54),(12,'Teste livro Bacanudo','wergehrsb ethw r',24.00),(13,'Xupenga','jwdghwgjb srgf r',67.33); /*!40000 ALTER TABLE `livros` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2017-03-04 12:58:19
true
067d2c7c6efa9f2ed38dcca3e84e119865cdaa00
SQL
PraktikumWebDasar41-02/modul6-rifqiryandi
/dbjurnal.sql
UTF-8
1,626
3
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.2 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Waktu pembuatan: 12 Okt 2018 pada 05.01 -- Versi server: 10.1.34-MariaDB -- Versi PHP: 7.2.7 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 NAMES utf8mb4 */; -- -- Database: `dbjurnal` -- -- -------------------------------------------------------- -- -- Struktur dari tabel `datadiri` -- CREATE TABLE `datadiri` ( `nim` bigint(11) NOT NULL, `nama` varchar(35) NOT NULL, `kelas` text NOT NULL, `jeniskelamin` text NOT NULL, `Hobi` text NOT NULL, `Fakultas` text NOT NULL, `Alamat` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data untuk tabel `datadiri` -- INSERT INTO `datadiri` (`nim`, `nama`, `kelas`, `jeniskelamin`, `Hobi`, `Fakultas`, `Alamat`) VALUES (670117, 'ryan', 'D3MI-41-01', 'laki-laki', 'Array', 'FIT', 'asda'), (6701177, 'raaa', 'D3MI-41-02', 'laki-laki', 'Bola,Musik', 'FIK', 'ASDASD'), (6701174004, 'raka', 'D3MI-41-01', 'laki-laki', 'Bola,Musik', 'FIT', 'blablab'); -- -- Indexes for dumped tables -- -- -- Indeks untuk tabel `datadiri` -- ALTER TABLE `datadiri` ADD PRIMARY KEY (`nim`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
1fb0b2cffb0f87bcf407f2512fce0243adb9da7f
SQL
JJHillWebDev/TripleS-Database
/EMPLOYEE.sql
UTF-8
1,212
3.03125
3
[]
no_license
INSERT INTO EMPLOYEE_INFO (EID, SSN, Green_Card,First_Name, Last_Name, DOB) VALUES (101, 123456789,NULL, 'Mathieu', 'Landretti', '02-03-2000'), (102, 123456787,NULL,'Jerry', 'Seinfeld','04-29-2000'), (103, 123456788,NULL, 'Amy', 'Johnson', '04-25-1996'); INSERT INTO EMPLOYEE_CONTACT(ECID, EID, Email, Address,Cell_Phone, Alt_Phone) VALUES (201, 101, 'mllandretti@gmail.com','2863 Galiter St.', 6126157018,6517669498), (202, 102, 'jerry@seinfeld.com', '1121 Nowhere Ave.',6516465339,6514448978), (203, 103,'amy@outlook.com', '3333 Place Rd.',6129778549,7633255698); INSERT INTO EMPLOYEE_DEPARTMENT (DID,EID,Department, Title) VALUES (301,101, 'Executive', 'Corporate Executive Officer'), (302,102,'Acconting', 'Accountant'), (303,103,'Information Technologies', 'Software Developer'); INSERT INTO EMPLOYEE_STATUS (ESID, EID, Hire_Date, Depart_Date) VALUES (401, 101, '01-14-2011',NULL), (402, 102, '05-17-2015',NULL), (403,103, '07-30-2009','05-18-2018'); INSERT INTO EMPLOYEE_PAY(EPID, EID, Pay_Type, Pay, Pay_Start, Pay_End) VALUES (501,101,'Salary', 120000, '01-14-2011', NULL), (502,102,'Hourly', 50, '05-17-2015', NULL), (503,103,'Salary', 95000, '07-30-2009','08-05-2018');
true
10f8e134476d28cf822fd5bded7b70361afbbe5b
SQL
awxm5698/babyManage
/baby/schema.sql
UTF-8
5,173
2.953125
3
[]
no_license
--drop table if exists user; --create table user( -- id integer primary key autoincrement, -- user_name character(20) unique not null, -- password character(100) not null, -- user_level integer default 1, -- phone character(11) default null, -- email character(50) unique not null, -- is_deleted integer default 0 , -- create_time datetime not null default current_timestamp --); -- --insert into user(user_name,password,user_level,email) --values('admin','pbkdf2:sha256:150000$Zzo3GwXQ$ff03f92556feceecd5059f293f1048b57d995c2bc2d83d340577eb61c3a915b1',0,'admin@admin.com'); -- -- --drop table if exists user_level; --create table user_level( -- id integer primary key autoincrement , -- name_en character not null , -- name_cn character not null --); -- --insert into user_level (id,name_en,name_cn) values (0,'Administrator','管理员'); --insert into user_level (id,name_en,name_cn) values (1,'Parent','家长'); --insert into user_level (id,name_en,name_cn) values (2,'Baby','宝贝'); -- --drop table if exists baby_info; --create table baby_info( -- id integer primary key autoincrement , -- user_id not null , -- baby_name not null , -- baby_sex integer default 0 , -- birthday not null , -- introduce text default null , -- create_time datetime default current_timestamp --); -- --drop table if exists sex; --create table sex( -- id integer primary key autoincrement, -- sex_en character not null , -- sex_cn character not null --); -- --insert into sex (sex_en,sex_cn) values ('boy','男'); --insert into sex (sex_en,sex_cn) values ('girl','女'); -- -- --drop table if exists manage_healthy; --create table manage_healthy( -- id integer primary key autoincrement , -- baby_id not null, -- height float not null, -- weight float not null, -- remarks text default null , -- record_date date not null, -- create_by integer not null , -- create_time datetime default current_timestamp --); -- --drop table if exists manage_diary; --create table manage_diary( -- id integer primary key autoincrement , -- baby_id not null, -- diary text not null , -- record_date date not null , -- record_by character not null , -- create_by integer not null , -- create_date datetime default current_timestamp , -- is_deleted integer default 0 --); -- -- --drop table if exists manage_album; --create table manage_album( -- id integer primary key autoincrement , -- baby_id not null, -- title character default null, -- body text default null , -- footprint integer default null, -- img_path character not null , -- record_date date not null, -- create_date datetime default current_timestamp , -- create_by integer not null , -- is_deleted integer default 0 --); -- --drop table if exists manage_footprint; --create table manage_footprint( -- id integer primary key autoincrement, -- user_id integer not null , -- record_date varchar not null , -- footprint_name character not null, -- footprint_desc character default null, -- is_deleted integer default 0 , -- create_time datetime default current_timestamp --); -- --drop table if exists config; --create table config( -- id integer primary key autoincrement , -- key varchar not null , -- value varchar not null , -- remarks varchar default null --); --insert into config (key,value) values ('img_path','../static/upload/'); --insert into config (key,value) values ('upload_path','C:\Users\vn02sdx\Documents\python\babyManages\baby\static'); -- --drop table if exists relative; --create table relative( -- id integer primary key autoincrement , -- call_name character not null , -- really_name character default null --); -- --insert into relative (call_name) values ('爸爸'); --insert into relative (call_name) values ('妈妈'); --2019-08-20 --insert into config (key,value) values ('img_extensions',"['png', 'jpg', 'jpeg', 'gif']"); --insert into config (key,value) values ('video_extensions',"['mp4']"); --alter table manage_footprint add column footprint_img character default null; --alter table manage_healthy add column is_deleted integer default 0; --alter table manage_album add column file_type integer default 0; --2019-08-21 --alter table relative add column birthday date default null; --update manage_album set img_path='upload/'||img_path where img_path not like 'upload/%'; --2019-08-22 --alter table manage_album add column small_img_path character default null; --alter table manage_album add column large_img_path character default null; --UPDATE manage_album SET small_img_path ='upload/small' || substr(img_path, 7) --WHERE img_path LIKE "upload/%"; --UPDATE manage_album SET large_img_path ='upload/large' || substr(img_path, 7) --WHERE img_path LIKE "upload/%"; --2019-08-23 --alter table relative add column baby_id integer default 1; --alter table baby_info add column is_default integer default 0; --2019-08-26 --alter table manage_footprint add column baby_id integer default null; --update manage_footprint set baby_id = 1 where user_id =1; --2019-08-29 --insert into config (key,value) values ('special','None');
true
127b7f914a5c2f2ae35f52bff7c14f5a0f475e37
SQL
hernanudea/SQL-Oracle-
/02 - Curso Oracle - Funciones 4.sql
ISO-8859-1
4,359
4.15625
4
[]
no_license
--VIDEO 20 -- TOCHAR() => convierte datos de otro tipo en tipo caracter --TO_CHAR(EXPR, [formato], [lenguaje]) SELECT TO_CHAR(10) FROM dual; SELECT TO_CHAR(0000001) FROM dual; SELECT TO_CHAR(000001, '09999999') FROM dual; --el 9 representa un digito --el cero inicial indica que si el numero tiene ceros al comienzo estos se deben mantener SELECT job_title, max_salary, TO_CHAR(max_salary, '$99,999.99'), TO_CHAR(max_salary, '$9,999.99') FROM jobs WHERE UPPER(job_title) LIKE '%PRESIDENT%'; --cuando el formato no puede representar el valor muestra los caracteres #### SELECT TO_CHAR(SYSDATE) FROM dual; SELECT TO_CHAR(SYSDATE, 'Month') FROM dual; SELECT TO_CHAR(SYSDATE, 'MM') FROM dual; SELECT TO_CHAR(SYSDATE, 'Mon') FROM dual; SELECT TO_CHAR(SYSDATE, 'YEAR') FROM dual; SELECT TO_CHAR(SYSDATE, 'YY') FROM dual; SELECT TO_CHAR(SYSDATE, 'YYYY') FROM dual; SELECT TO_CHAR(SYSDATE, 'DAY') FROM dual; SELECT TO_CHAR(SYSDATE, 'DD') FROM dual; SELECT TO_CHAR(SYSDATE, 'D') FROM dual; --extraemos solo una parte de la fecha, existen otros modificadores SELECT first_name || ' ' || last_name "Nombre Completo", SUBSTR(first_name, 1,1) ||'. '|| last_name "Nombre Corto", TO_CHAR(hire_date, 'fmDD Month YYYY') "Fecha Contratacin" FROM EMPLOYEES; --utilizando el tercer argmento, otro lenguaje SELECT TO_CHAR(SYSDATE, 'Day Ddspth, Month YYYY', 'nls_date_language=German') from dual; --sp => mostrar el dia por sus letras --ht => dia ordinal --con otro lenguaje SELECT TO_CHAR(SYSDATE, 'Day Ddspth, Month YYYY', 'nls_date_language=Danish') from dual; --VIDEO 21 --TO_DATE(c, [fmt], [nslparam]) --para cambia el formato de las fechas ALTER SESSION SET nls_date_format = 'DD-Mon-RRRR HH24:MI:SS'; --el cambio es solo a nivel de seccin --los parametros no indicados se pone en con ceros SELECT TO_DATE('25_Dic_2017') from dual; SELECT TO_DATE('25-Dic', 'DD-MM') FROM DUAL; --el segundo parametro es un nuevo formato --el ao por defecto es el ao actual SELECT TO_DATE('25-Dic-2017 18:25:36', 'DD-Mon-YYYY HH24:MI:SS') FROM DUAL; SELECT TO_DATE('30-Sep-2007', 'DD/Mon/YYYY') FROM DUAL; SELECT TO_DATE('Sep-2007 13', 'Mon/YYYY HH24') FROM dual; -- el 13 es la hora SELECT first_name, last_name, hire_date FROM employees WHERE hire_date > TO_DATE('01/12/2000', 'MM/DD/YYYY') ORDER BY hire_Date; --ver documentacin para mas formatos de tipo fecha --VIDEO 22 --funciones para fechas --SYSDATE => fecha actual SELECT SYSDATE FROM dual; --ADD_MONTHS(d, i) => agrega una cantidad de meses a una fecha --donde d es una fecha e i los meses a agregar SELECT SYSDATE, ADD_MONTHS(SYSDATE, -1) ANTERIOR, ADD_MONTHS(SYSDATE, 12) "En un Ao"FROM dual; --MONTHS_BETWEEN() cantidad de meses entre dos fechas SELECT FLOOR(MONTHS_BETWEEN('21/02/1979', '08-04-1992')) f1, FLOOR(MONTHS_BETWEEN('30-10-2013', '19-10-2016')) f2, FLOOR(MONTHS_BETWEEN('21/02/1979', '26-06-1986')) f3, FLOOR(MONTHS_BETWEEN('28-02-2010', '31/03/2008')) f4, FLOOR(MONTHS_BETWEEN('31/03/2008', '28-02-2010')) f5 FROM dual; --retorna negativo cuando la primera fecha ocurre primero en el timpo, positivos en el caso contrario --LAST_DAY => retorna el ultimo dia del mes actual SELECT SYSDATE, LAST_DAY(SYSDATE) fin_de_mes from dual; SELECT LAST_DAY('01-02-2900') FROM DUAL; -- no es bisiesto SELECT SYSDATE HOY, LAST_DAY(SYSDATE) "FIN DE MES", --ultimo dia del mes LAST_DAY(SYSDATE) + 1 "SIGUIENTE MES" --primer dia siguiente mes FROM dual; --si sumamos (restamos) a una fecha un entero, esa cantidad de dias en la fecha ALTER SESSION SET NLS_DATE_FORMAT='DD-Mon-YYYY HH24:MI:SS'; --ROUND(d, [fmt]) => redondeo SELECT SYSDATE, ROUND(SYSDATE, 'HH24') "REDONDEO EN HORAS", ROUND(SYSDATE) "REDONDEO FECHA", ROUND(SYSDATE, 'MM') "REDONDEO MESES", ROUND(SYSDATE, 'YY') "REDONDEO AOS" FROM dual; --desde la mitad del dia se redondea al siguiente dia --TRUNC(d, [fmt]) => reemplaza en una fecha SELECT SYSDATE, TRUNC(SYSDATE, 'HH24') "REDONDEO EN HORAS", TRUNC(SYSDATE) "REDONDEO FECHA", TRUNC(SYSDATE, 'MM') "REDONDEO MESES", TRUNC(SYSDATE, 'YY') "REDONDEO AOS" FROM dual; -- redondea al comienzo del dia
true
1e62cb9b13a7691cdc74e00f19a863fe48a33ba2
SQL
DenisKasyanenka/Oauth2-client-and-server-for-WSO2
/server/src/main/resources/sql-scripts/data.sql
UTF-8
676
2.5625
3
[]
no_license
INSERT INTO app_role (id, role_name, description) VALUES (1, 'ROLE_USER1', 'Standard User - Has no admin rights'); INSERT INTO app_role (id, role_name, description) VALUES (2, 'ROLE_ADMIN', 'Admin User - Has permission to perform admin tasks'); -- password: password INSERT INTO app_user (id, first_name, last_name, password, username) VALUES (1, 'John', 'Doe', '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8', 'user'); INSERT INTO app_user (id, first_name, last_name, password, username) VALUES (2, 'Admin', 'Admin', '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8', 'admin'); INSERT INTO user_role(user_id, role_id) VALUES(1,1); INSERT INTO user_role(user_id, role_id) VALUES(2,1); INSERT INTO user_role(user_id, role_id) VALUES(2,2);
true
70e847058d2622df68c16040cc113eb3eb7b0675
SQL
MrSanySnay/DB_2_2
/Лабораторная работа номер 7/3. Дополнительное задание.sql
WINDOWS-1251
200
3.28125
3
[]
no_license
use K_UNIVER SELECT [GROUP].IDGROUP, count(STUDENT.IDSTUDENT) [- ] FROM [GROUP] inner join STUDENT ON [GROUP].IDGROUP = STUDENT.IDGROUP group by [GROUP].IDGROUP
true
98a30d628aef4f44c73a2bdd385da641057a09f0
SQL
valentina1978/Tekwill-SQL
/lesson 9-10/Valentina.sql
UTF-8
3,181
4.03125
4
[]
no_license
select phone_number ,to_number (replace (phone_number,'.',','),'999,999,9999') as to_number_1 ,to_number (replace (phone_number,'.',','),'9999999999')as to_number_2 ,to_char (145.782,'999D999') as to_char from employees where employee_id between 100 and 144; select first_name ||' '||Last_name as fullName ,job_id ,salary ,department_id ,manager_id ,CASE job_id when 'ST_CLERK' THEN salary *0.5 when 'AC_ACCOUNT' THEN SALARY *0.75 when 'ST_MAN' THEN salary * 0.4 ELSE salary END as salary_modified ,CASE WHEN job_id='IT_PROG' and salary >6000 Then department_id WHEN job_id='SA_REP' and salary >8000 Then department_id else manager_id END as case_with_more_condition ,DECODE (JOB_ID, 'ST_CLERK', salary *0.5) as ST_CLERK_O5 ,'AC_ACCOUNT', SALARY *0.75 as AC_ACCOUNT_075 ,'ST_MAN', salary * 0.4 AS ST_MAN_04 ,SALARY as salary_with_decode from employees; select sum (salary) as total_salary ,min(salary) as min_salary ,max(salary) as max_salary ,avg(salary) as avg_salary ,count(employee_id) as count_employee_id ,count (commission_pct) as count_commission_pct ,count(nvl(commission_pct,0)) as count_commission_pct ,count(*)as count_all from employees; select count(distinct job_id) as job_id_1 ,count(job_id) as job_id_2 ,sum(salary) as salary_1 --sunt sumate valorile unice ,sum(distinct salary) as salary_2 --din suma a scos valorile dublate from employees; select distinct count(distinct job_id) as job_id_1 ,count(job_id) as job_id_2 ,sum(salary) as salary_1 --sunt sumate valorile unice ,sum(distinct salary) as salary_2 --din suma a scos valorile dublate from employees; select count(distinct job_id) as job_id_1 ,count(job_id) as job_id_2 ,sum(salary) as salary_1 --sunt sumate valorile unice ,sum(distinct salary) as salary_2 --din suma a scos valorile dublate ,min(hire_date) as min_hire_date ,max(hire_date) as max_hire_date from employees where job_id='SA_REP'; select department_id as department_id , Round(avg(salary),2) from employees group by department_id; select nvl(department_id,10) as department_id , Round(avg(salary),2) from employees group by nvl(department_id,10); select avg(salary) from employees group by department_id; select department_id ,job_id ,manager_id ,avg(salary) ,min(hire_date) ,max(hire_date) ,max(salary) from employees where department_id between 50 and 100 group by department_id, manager_id, job_id order by 1; --sortarea merge dupa prima coloana din tabel select department_id ,job_id ,manager_id ,avg(salary) ,min(hire_date) ,max(hire_date) ,max(salary) from employees where department_id between 50 and 100 and salary >=10000 group by department_id, manager_id, job_id having max(salary) >=10000 --salariu maxim sa fie m mult de 10000 order by 1; --sortarea merge dupa prima coloana din tabel
true
0ed726acebec325cc7c81fdd4ea361499e8f1d79
SQL
kadenaperpetua/twu_biblioteca_database_gabriela_guaman
/q5.sql
UTF-8
180
3.390625
3
[]
no_license
SELECT member.name FROM member WHERE member.id IN ( SELECT checkout_item.member_id FROM checkout_item GROUP BY checkout_item.member_id HAVING COUNT(checkout_item.member_id) > 1)
true
fc664c879c6d54cdc6b3031a1085df7d182a3245
SQL
percevalseb1309/ExpressFood
/express_food.sql
UTF-8
21,609
3.375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.6.4 -- https://www.phpmyadmin.net/ -- -- Client : 127.0.0.1 -- Généré le : Mar 05 Septembre 2017 à 23:33 -- Version du serveur : 5.7.14 -- Version de PHP : 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 */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Base de données : `express_food` -- -- -------------------------------------------------------- -- -- Structure de la table `adresse` -- CREATE TABLE `adresse` ( `id` int(10) UNSIGNED NOT NULL, `rue` varchar(45) NOT NULL, `ville` varchar(45) NOT NULL, `code_postal` char(5) NOT NULL, `client_id` int(10) UNSIGNED NOT NULL, `zone_id` tinyint(1) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `adresse` -- INSERT INTO `adresse` (`id`, `rue`, `ville`, `code_postal`, `client_id`, `zone_id`) VALUES (1, '18 Rue des Abbesses', 'Paris', '75018', 1, 2), (2, '7 Pont des Arts', 'Paris', '75001', 1, 1), (3, '3 Boulevard de Belleville', 'Paris', '75011', 2, 3), (4, '14Rue d\'Alésia', 'Paris', '75014', 3, 4), (5, 'Rue Alfred-Dehodencq', 'Paris', '75016', 4, 5), (6, '1 bis Rue Jean-Dollfus', 'Paris', '75018', 6, 2), (7, '85 Rue Montorgueil', 'Paris', '75002', 6, 1); -- -------------------------------------------------------- -- -- Structure de la table `balise_gps` -- CREATE TABLE `balise_gps` ( `id` tinyint(3) UNSIGNED NOT NULL, `reference` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `catalogue` -- CREATE TABLE `catalogue` ( `id` int(10) UNSIGNED NOT NULL, `date` date NOT NULL, `quantite` smallint(5) UNSIGNED DEFAULT NULL, `produit_id` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `catalogue` -- INSERT INTO `catalogue` (`id`, `date`, `quantite`, `produit_id`) VALUES (1, '2017-09-04', 7, 1), (2, '2017-09-04', 12, 2), (3, '2017-09-04', 7, 3), (4, '2017-09-04', 8, 4), (5, '2017-09-05', 12, 5), (6, '2017-09-05', 3, 6), (7, '2017-09-05', 9, 7), (8, '2017-09-05', 12, 8), (9, '2017-09-06', 48, 9), (10, '2017-09-06', 49, 10), (11, '2017-09-06', 49, 11), (12, '2017-09-06', 48, 12), (13, '2017-09-07', NULL, 13), (14, '2017-09-07', NULL, 14), (15, '2017-09-07', NULL, 15), (16, '2017-09-07', NULL, 16); -- -------------------------------------------------------- -- -- Structure de la table `client` -- CREATE TABLE `client` ( `id` int(10) UNSIGNED NOT NULL, `date_inscription` date NOT NULL, `email` varchar(45) NOT NULL, `telephone` char(10) DEFAULT NULL, `utilisateur_id` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `client` -- INSERT INTO `client` (`id`, `date_inscription`, `email`, `telephone`, `utilisateur_id`) VALUES (1, '2017-08-03', 'mi.enim.condimentum@dictumeu.edu', '0416349375', 4), (2, '2017-08-03', 'eros@commodo.net', '0166712483', 5), (3, '2017-07-24', 'dignissim@pharetrafeliseget.ca', NULL, 6), (4, '2017-08-26', 'pellentesque.a@quam.org', '0650479796', 8), (5, '2017-06-14', 'parturient.montes@eu.net', NULL, 9), (6, '2017-08-25', 'quis.pede@magna.com', '0647929122', 10); -- -------------------------------------------------------- -- -- Structure de la table `commande` -- CREATE TABLE `commande` ( `id` int(10) UNSIGNED NOT NULL, `date` timestamp NOT NULL, `statut` enum('en attente','en cours de livraison','livrée') NOT NULL, `numero` int(10) UNSIGNED NOT NULL, `client_id` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `commande` -- INSERT INTO `commande` (`id`, `date`, `statut`, `numero`, `client_id`) VALUES (1, '2017-09-04 10:27:50', 'livrée', 1693061761, 1), (2, '2017-09-06 11:12:35', 'livrée', 1658101032, 3), (3, '2017-09-06 11:25:44', 'en cours de livraison', 1656121784, 4); -- -------------------------------------------------------- -- -- Structure de la table `ligne_commande` -- CREATE TABLE `ligne_commande` ( `commande_id` int(10) UNSIGNED NOT NULL, `produit_id` int(10) UNSIGNED NOT NULL, `quantite` tinyint(2) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `ligne_commande` -- INSERT INTO `ligne_commande` (`commande_id`, `produit_id`, `quantite`) VALUES (1, 1, 1), (1, 3, 1), (2, 9, 2), (2, 11, 1), (2, 12, 1), (3, 10, 1), (3, 12, 1); -- -------------------------------------------------------- -- -- Structure de la table `livraison` -- CREATE TABLE `livraison` ( `id` int(10) UNSIGNED NOT NULL, `date` timestamp NOT NULL, `numero_facture` int(10) UNSIGNED NOT NULL, `commande_id` int(10) UNSIGNED NOT NULL, `adresse_id` int(10) UNSIGNED NOT NULL, `livreur_id` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `livraison` -- INSERT INTO `livraison` (`id`, `date`, `numero_facture`, `commande_id`, `adresse_id`, `livreur_id`) VALUES (1, '2017-09-04 10:40:32', 16920415, 1, 2, 1), (2, '2017-09-06 11:31:24', 16600924, 2, 4, 2); -- -------------------------------------------------------- -- -- Structure de la table `livreur` -- CREATE TABLE `livreur` ( `id` int(10) UNSIGNED NOT NULL, `statut` enum('indisponible','disponible','en cours de livraison') NOT NULL DEFAULT 'indisponible', `position` varchar(22) DEFAULT NULL, `utilisateur_id` int(10) UNSIGNED NOT NULL, `zone_id` tinyint(1) UNSIGNED NOT NULL, `velo_id` tinyint(3) UNSIGNED DEFAULT NULL, `sac_isotherme_id` tinyint(3) UNSIGNED DEFAULT NULL, `balise_gps_id` tinyint(3) UNSIGNED DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `livreur` -- INSERT INTO `livreur` (`id`, `statut`, `position`, `utilisateur_id`, `zone_id`, `velo_id`, `sac_isotherme_id`, `balise_gps_id`) VALUES (1, 'disponible', '19.19144, -106.74976', 3, 4, NULL, NULL, NULL), (2, 'en cours de livraison', '-19.5095, 103.5388', 7, 5, NULL, NULL, NULL); -- -------------------------------------------------------- -- -- Structure de la table `message` -- CREATE TABLE `message` ( `id` int(10) UNSIGNED NOT NULL, `date` timestamp NOT NULL, `sujet` varchar(45) NOT NULL, `contenu` longtext NOT NULL, `client_id` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `panier` -- CREATE TABLE `panier` ( `client_id` int(10) UNSIGNED NOT NULL, `produits_id` int(10) UNSIGNED NOT NULL, `date` date NOT NULL, `quantite` tinyint(2) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `panier` -- INSERT INTO `panier` (`client_id`, `produits_id`, `date`, `quantite`) VALUES (1, 1, '2017-08-05', 2), (1, 3, '2017-08-05', 2); -- -------------------------------------------------------- -- -- Structure de la table `produit` -- CREATE TABLE `produit` ( `id` int(10) UNSIGNED NOT NULL, `type` enum('plat','dessert') NOT NULL, `reference` varchar(45) NOT NULL, `nom` varchar(128) NOT NULL, `descriptif` longtext, `prix_unitaire_ht` decimal(4,2) NOT NULL, `tx_tva` decimal(6,4) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `produit` -- INSERT INTO `produit` (`id`, `type`, `reference`, `nom`, `descriptif`, `prix_unitaire_ht`, `tx_tva`) VALUES (1, 'plat', '16390218-9160', 'Escalope de dinde-pommes de terre-compote', NULL, '14.75', '20.0000'), (2, 'plat', '16800720-3683', 'Pain de viande-Purée-Petits pois', NULL, '17.75', '20.0000'), (3, 'dessert', '16640518-2616', 'Fondant au chocolat', NULL, '8.35', '20.0000'), (4, 'dessert', '16850811-1005', 'Tarte au citron meringuée', NULL, '9.90', '20.0000'), (5, 'plat', '16800727-2803', 'Quiche Lorraine', NULL, '18.75', '20.0000'), (6, 'plat', '16070418-5958', 'Rösti - Escalopes milanaises - Légumes surgelés', NULL, '17.60', '20.0000'), (7, 'dessert', '16500507-0247', 'Tiramisu', NULL, '8.10', '20.0000'), (8, 'dessert', '16090710-9037', 'Muffins', NULL, '6.30', '20.0000'), (9, 'plat', '16950419-4789', 'Couscous', NULL, '19.25', '20.0000'), (10, 'plat', '16150325-8996', 'Salade de riz aux haricots rouges et au thon', NULL, '15.45', '20.0000'), (11, 'dessert', '16210514-2588', 'Tarte normande', NULL, '5.65', '20.0000'), (12, 'dessert', '16700526-1370', 'Crumble', NULL, '3.25', '20.0000'), (13, 'plat', '16780307-5865', 'Saucisses de volaille-pommes de terre-brocoli ', NULL, '17.35', '20.0000'), (14, 'plat', '16600607-7595', 'Mijoté de boeuf léger aux petits pois et aux carottes', NULL, '16.15', '20.0000'), (15, 'dessert', '16170526-5583', 'Roulé à la fraise', NULL, '5.85', '20.0000'), (16, 'dessert', '16230601-5526', 'Pannacotta', NULL, '8.60', '20.0000'); -- -------------------------------------------------------- -- -- Structure de la table `role` -- CREATE TABLE `role` ( `id` tinyint(1) UNSIGNED NOT NULL, `nom` varchar(15) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `role` -- INSERT INTO `role` (`id`, `nom`) VALUES (1, 'administrateur'), (4, 'client'), (3, 'livreur'), (2, 'service client'); -- -------------------------------------------------------- -- -- Structure de la table `sac_isotherme` -- CREATE TABLE `sac_isotherme` ( `id` tinyint(3) UNSIGNED NOT NULL, `reference` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `sac_livreur` -- CREATE TABLE `sac_livreur` ( `livreur_id` int(10) UNSIGNED NOT NULL, `produit_id` int(10) UNSIGNED NOT NULL, `quantite` tinyint(2) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `sac_livreur` -- INSERT INTO `sac_livreur` (`livreur_id`, `produit_id`, `quantite`) VALUES (1, 9, 25), (1, 10, 25), (1, 11, 25), (1, 12, 25), (2, 9, 25), (2, 10, 25), (2, 11, 25), (2, 12, 25); -- -------------------------------------------------------- -- -- Structure de la table `stock` -- CREATE TABLE `stock` ( `id` int(10) UNSIGNED NOT NULL, `quantite` smallint(5) UNSIGNED NOT NULL, `produit_id` int(10) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `stock` -- INSERT INTO `stock` (`id`, `quantite`, `produit_id`) VALUES (1, 48, 9), (2, 49, 10), (3, 50, 11), (4, 50, 12); -- -------------------------------------------------------- -- -- Structure de la table `utilisateur` -- CREATE TABLE `utilisateur` ( `id` int(10) UNSIGNED NOT NULL, `nom_utilisateur` varchar(45) NOT NULL, `mot_de_passe` varchar(45) NOT NULL, `nom` varchar(45) NOT NULL, `prenom` varchar(45) NOT NULL, `sexe` enum('M','F') NOT NULL, `role_id` tinyint(1) UNSIGNED NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `utilisateur` -- INSERT INTO `utilisateur` (`id`, `nom_utilisateur`, `mot_de_passe`, `nom`, `prenom`, `sexe`, `role_id`) VALUES (1, 'romain.rolland', 'SAP01OGW7WG', 'Rolland', 'Romain', 'M', 1), (2, 'leane.chevalier', 'IYI11ZAA5IK', 'Chevalier', 'Léane', 'F', 2), (3, 'chloe.guerin', 'KRI37PXR4PC', 'Guerin', 'Chloé', 'F', 3), (4, 'elena.clement', 'ODA83IYS3BW', 'Clement', 'Éléna', 'F', 4), (5, 'renaud.bouvier', 'UVM18FTZ7BT', 'Bouvier', 'Renaud', 'M', 4), (6, 'noemie.michel', 'WYL46EAP3CY', 'Michel', 'Noémie', 'F', 4), (7, 'elouan.louis', 'ZAS77JZY9DD', 'Louis', 'Élouan', 'M', 3), (8, 'tatiana.roger', 'XJD35EHY7LQ', 'Roger', 'Tatiana', 'F', 4), (9, 'juliette.pereira', 'NRW80BKQ8UO', 'Pereira', 'Juliette', 'F', 4), (10, 'timothee.masson', 'WRJ10XOS6IM', 'Masson', 'Timothée', 'M', 4); -- -------------------------------------------------------- -- -- Structure de la table `velo` -- CREATE TABLE `velo` ( `id` tinyint(3) UNSIGNED NOT NULL, `reference` varchar(45) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Structure de la table `zone` -- CREATE TABLE `zone` ( `id` tinyint(1) UNSIGNED NOT NULL, `nom` varchar(6) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Contenu de la table `zone` -- INSERT INTO `zone` (`id`, `nom`) VALUES (1, 'CENTRE'), (3, 'EST'), (2, 'NORD'), (5, 'OUEST'), (4, 'SUD'); -- -- Index pour les tables exportées -- -- -- Index pour la table `adresse` -- ALTER TABLE `adresse` ADD PRIMARY KEY (`id`), ADD KEY `fk_adresse_client1_idx` (`client_id`), ADD KEY `fk_adresse_zone1_idx` (`zone_id`); -- -- Index pour la table `balise_gps` -- ALTER TABLE `balise_gps` ADD PRIMARY KEY (`id`); -- -- Index pour la table `catalogue` -- ALTER TABLE `catalogue` ADD PRIMARY KEY (`id`), ADD KEY `fk_stock_produit1_idx` (`produit_id`); -- -- Index pour la table `client` -- ALTER TABLE `client` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `email_UNIQUE` (`email`), ADD UNIQUE KEY `telephone_UNIQUE` (`telephone`), ADD KEY `fk_client_utilisateur1_idx` (`utilisateur_id`); -- -- Index pour la table `commande` -- ALTER TABLE `commande` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `numero_UNIQUE` (`numero`), ADD KEY `fk_commande_client1_idx` (`client_id`); -- -- Index pour la table `ligne_commande` -- ALTER TABLE `ligne_commande` ADD PRIMARY KEY (`commande_id`,`produit_id`), ADD KEY `fk_commande_has_produit_produit1_idx` (`produit_id`), ADD KEY `fk_commande_has_produit_commande1_idx` (`commande_id`); -- -- Index pour la table `livraison` -- ALTER TABLE `livraison` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `numero_facture_UNIQUE` (`numero_facture`), ADD KEY `fk_livraison_commande1_idx` (`commande_id`), ADD KEY `fk_livraison_livreur1_idx` (`livreur_id`), ADD KEY `fk_livraison_adresse1_idx` (`adresse_id`); -- -- Index pour la table `livreur` -- ALTER TABLE `livreur` ADD PRIMARY KEY (`id`), ADD KEY `fk_livreur_utilisateur1_idx` (`utilisateur_id`), ADD KEY `fk_livreur_zone1_idx` (`zone_id`), ADD KEY `fk_livreur_velo1_idx` (`velo_id`), ADD KEY `fk_livreur_sac_isotherme1_idx` (`sac_isotherme_id`), ADD KEY `fk_livreur_balise_gps1_idx` (`balise_gps_id`); -- -- Index pour la table `message` -- ALTER TABLE `message` ADD PRIMARY KEY (`id`), ADD KEY `fk_message_client1_idx` (`client_id`); -- -- Index pour la table `panier` -- ALTER TABLE `panier` ADD PRIMARY KEY (`client_id`,`produits_id`), ADD KEY `fk_client_has_produits_produits1_idx` (`produits_id`), ADD KEY `fk_client_has_produits_client1_idx` (`client_id`); -- -- Index pour la table `produit` -- ALTER TABLE `produit` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `reference_UNIQUE` (`reference`); -- -- Index pour la table `role` -- ALTER TABLE `role` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `nom_UNIQUE` (`nom`); -- -- Index pour la table `sac_isotherme` -- ALTER TABLE `sac_isotherme` ADD PRIMARY KEY (`id`); -- -- Index pour la table `sac_livreur` -- ALTER TABLE `sac_livreur` ADD PRIMARY KEY (`livreur_id`,`produit_id`), ADD KEY `fk_livreur_has_produit_produit1_idx` (`produit_id`), ADD KEY `fk_livreur_has_produit_livreur1_idx` (`livreur_id`); -- -- Index pour la table `stock` -- ALTER TABLE `stock` ADD PRIMARY KEY (`id`), ADD KEY `fk_stock_produit1_idx` (`produit_id`); -- -- Index pour la table `utilisateur` -- ALTER TABLE `utilisateur` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `nom_utilsateur_UNIQUE` (`nom_utilisateur`), ADD KEY `fk_utilisateur_role1_idx` (`role_id`); -- -- Index pour la table `velo` -- ALTER TABLE `velo` ADD PRIMARY KEY (`id`); -- -- Index pour la table `zone` -- ALTER TABLE `zone` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `nom_UNIQUE` (`nom`); -- -- AUTO_INCREMENT pour les tables exportées -- -- -- AUTO_INCREMENT pour la table `adresse` -- ALTER TABLE `adresse` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT pour la table `balise_gps` -- ALTER TABLE `balise_gps` MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT pour la table `catalogue` -- ALTER TABLE `catalogue` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17; -- -- AUTO_INCREMENT pour la table `client` -- ALTER TABLE `client` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT pour la table `commande` -- ALTER TABLE `commande` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT pour la table `livraison` -- ALTER TABLE `livraison` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT pour la table `livreur` -- ALTER TABLE `livreur` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT pour la table `message` -- ALTER TABLE `message` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT pour la table `produit` -- ALTER TABLE `produit` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26; -- -- AUTO_INCREMENT pour la table `sac_isotherme` -- ALTER TABLE `sac_isotherme` MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT pour la table `stock` -- ALTER TABLE `stock` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT pour la table `utilisateur` -- ALTER TABLE `utilisateur` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11; -- -- AUTO_INCREMENT pour la table `velo` -- ALTER TABLE `velo` MODIFY `id` tinyint(3) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- Contraintes pour les tables exportées -- -- -- Contraintes pour la table `adresse` -- ALTER TABLE `adresse` ADD CONSTRAINT `fk_adresse_client` FOREIGN KEY (`client_id`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_adresse_zone1` FOREIGN KEY (`zone_id`) REFERENCES `zone` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `catalogue` -- ALTER TABLE `catalogue` ADD CONSTRAINT `fk_stock_produit10` FOREIGN KEY (`produit_id`) REFERENCES `produit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `client` -- ALTER TABLE `client` ADD CONSTRAINT `fk_client_utilisateur1` FOREIGN KEY (`utilisateur_id`) REFERENCES `utilisateur` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `commande` -- ALTER TABLE `commande` ADD CONSTRAINT `fk_commande_client1` FOREIGN KEY (`client_id`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `ligne_commande` -- ALTER TABLE `ligne_commande` ADD CONSTRAINT `fk_commande_has_produit_commande1` FOREIGN KEY (`commande_id`) REFERENCES `commande` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_commande_has_produit_produit1` FOREIGN KEY (`produit_id`) REFERENCES `produit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `livraison` -- ALTER TABLE `livraison` ADD CONSTRAINT `fk_livraison_adresse1` FOREIGN KEY (`adresse_id`) REFERENCES `adresse` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_livraison_commande1` FOREIGN KEY (`commande_id`) REFERENCES `commande` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_livraison_livreur1` FOREIGN KEY (`livreur_id`) REFERENCES `livreur` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `livreur` -- ALTER TABLE `livreur` ADD CONSTRAINT `fk_livreur_balise_gps1` FOREIGN KEY (`balise_gps_id`) REFERENCES `balise_gps` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_livreur_sac_isotherme1` FOREIGN KEY (`sac_isotherme_id`) REFERENCES `sac_isotherme` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_livreur_utilisateur1` FOREIGN KEY (`utilisateur_id`) REFERENCES `utilisateur` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_livreur_velo1` FOREIGN KEY (`velo_id`) REFERENCES `velo` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_livreur_zone1` FOREIGN KEY (`zone_id`) REFERENCES `zone` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `message` -- ALTER TABLE `message` ADD CONSTRAINT `fk_message_client1` FOREIGN KEY (`client_id`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `panier` -- ALTER TABLE `panier` ADD CONSTRAINT `fk_client_has_produits_client1` FOREIGN KEY (`client_id`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_client_has_produits_produits1` FOREIGN KEY (`produits_id`) REFERENCES `produit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `sac_livreur` -- ALTER TABLE `sac_livreur` ADD CONSTRAINT `fk_livreur_has_produit_livreur1` FOREIGN KEY (`livreur_id`) REFERENCES `livreur` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `fk_livreur_has_produit_produit1` FOREIGN KEY (`produit_id`) REFERENCES `produit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `stock` -- ALTER TABLE `stock` ADD CONSTRAINT `fk_stock_produit1` FOREIGN KEY (`produit_id`) REFERENCES `produit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Contraintes pour la table `utilisateur` -- ALTER TABLE `utilisateur` ADD CONSTRAINT `fk_utilisateur_role1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
6a3680fd0bc83b6a4a9ddfe8278f88616bbf692b
SQL
ducquyen/mycorpro-Indonesian-Couriers-Service-PRO
/query.sql
UTF-8
3,474
2.765625
3
[]
no_license
ALTER TABLE `oc_order` ADD `payment_district_id` INT(11) NULL DEFAULT NULL, ADD `shipping_district_id` INT(11) NULL DEFAULT NULL, ADD `payment_district` VARCHAR(128) NULL DEFAULT NULL, ADD `shipping_district` VARCHAR(128) NULL DEFAULT NULL; ALTER TABLE oc_address ADD COLUMN district_id INT(11) NULL; ALTER TABLE oc_zone ADD COLUMN raoprop_id INT(11) NULL; ALTER TABLE oc_address ADD COLUMN subdistrict_id INT(11) NULL;//new ALTER TABLE `oc_order` ADD `payment_subdistrict_id` INT(11) NULL DEFAULT NULL, ADD `shipping_subdistrict_id` INT(11) NULL DEFAULT NULL, ADD `payment_subdistrict` VARCHAR(128) NULL DEFAULT NULL, ADD `shipping_subdistrict` VARCHAR(128) NULL DEFAULT NULL; //new UPDATE oc_zone SET name = 'Nusa Tenggara Barat (NTB)' WHERE name = 'Nusa Tenggara Barat'; UPDATE oc_zone SET name = 'Nusa Tenggara Timur (NTT)' WHERE name = 'Nusa Tenggara Timur'; UPDATE oc_zone SET name = 'Bangka Belitung' WHERE name = 'Kepulauan Bangka Belitung'; UPDATE oc_zone SET name = 'DKI Jakarta' WHERE name = 'Jakarta'; UPDATE oc_zone SET name = 'Nanggroe Aceh Darussalam (NAD)' WHERE name = 'Aceh'; UPDATE oc_zone SET name = 'DI Yogyakarta' WHERE name = 'Yogyakarta'; UPDATE oc_zone SET raoprop_id ='1' WHERE name = 'Bali'; UPDATE oc_zone SET raoprop_id ='2' WHERE name = 'Bangka Belitung'; UPDATE oc_zone SET raoprop_id ='3' WHERE name = 'Banten'; UPDATE oc_zone SET raoprop_id ='4' WHERE name = 'Bengkulu'; UPDATE oc_zone SET raoprop_id ='5' WHERE name = 'DI Yogyakarta'; UPDATE oc_zone SET raoprop_id ='6' WHERE name = 'DKI Jakarta'; UPDATE oc_zone SET raoprop_id ='7' WHERE name = 'Gorontalo'; UPDATE oc_zone SET raoprop_id ='8' WHERE name = 'Jambi'; UPDATE oc_zone SET raoprop_id ='9' WHERE name = 'Jawa Barat'; UPDATE oc_zone SET raoprop_id ='10' WHERE name = 'Jawa Tengah'; UPDATE oc_zone SET raoprop_id ='11' WHERE name = 'Jawa Timur'; UPDATE oc_zone SET raoprop_id ='12' WHERE name = 'Kalimantan Barat'; UPDATE oc_zone SET raoprop_id ='13' WHERE name = 'Kalimantan Selatan'; UPDATE oc_zone SET raoprop_id ='14' WHERE name = 'Kalimantan Tengah'; UPDATE oc_zone SET raoprop_id ='15' WHERE name = 'Kalimantan Timur'; UPDATE oc_zone SET raoprop_id ='16' WHERE name = 'Kalimantan Utara'; UPDATE oc_zone SET raoprop_id ='17' WHERE name = 'Kepulauan Riau'; UPDATE oc_zone SET raoprop_id ='18' WHERE name = 'Lampung'; UPDATE oc_zone SET raoprop_id ='19' WHERE name = 'Maluku'; UPDATE oc_zone SET raoprop_id ='20' WHERE name = 'Maluku Utara'; UPDATE oc_zone SET raoprop_id ='21' WHERE name = 'Nanggroe Aceh Darussalam (NAD)'; UPDATE oc_zone SET raoprop_id ='22' WHERE name = 'Nusa Tenggara Barat (NTB)'; UPDATE oc_zone SET raoprop_id ='23' WHERE name = 'Nusa Tenggara Timur (NTT)'; UPDATE oc_zone SET raoprop_id ='24' WHERE name = 'Papua'; UPDATE oc_zone SET raoprop_id ='25' WHERE name = 'Papua Barat'; UPDATE oc_zone SET raoprop_id ='26' WHERE name = 'Riau'; UPDATE oc_zone SET raoprop_id ='27' WHERE name = 'Sulawesi Barat'; UPDATE oc_zone SET raoprop_id ='28' WHERE name = 'Sulawesi Selatan'; UPDATE oc_zone SET raoprop_id ='29' WHERE name = 'Sulawesi Tengah'; UPDATE oc_zone SET raoprop_id ='30' WHERE name = 'Sulawesi Tenggara'; UPDATE oc_zone SET raoprop_id ='31' WHERE name = 'Sulawesi Utara'; UPDATE oc_zone SET raoprop_id ='32' WHERE name = 'Sumatera Barat'; UPDATE oc_zone SET raoprop_id ='33' WHERE name = 'Sumatera Selatan'; UPDATE oc_zone SET raoprop_id ='34' WHERE name = 'Sumatera Utara';
true
0a50fec26682dbac90d39c4de9c35ecf2ea45c71
SQL
dipendrabharati/DatabaseManagementSystem
/homeworks/databasemodel.sql
UTF-8
13,816
3.28125
3
[]
no_license
-- 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='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; -- ----------------------------------------------------- -- Schema new1 -- ----------------------------------------------------- -- ----------------------------------------------------- -- Schema new1 -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `new1` DEFAULT CHARACTER SET utf8 ; USE `new1` ; -- ----------------------------------------------------- -- Table `new1`.`category` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`category` ( `Cid` INT(11) NOT NULL, `Cname` VARCHAR(45) NOT NULL, PRIMARY KEY (`Cid`)) ENGINE = InnoDB AUTO_INCREMENT = 4 DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`bank` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`bank` ( `Bankid` INT(11) NOT NULL, `BankName` VARCHAR(45) NULL DEFAULT NULL, `Amount` INT(11) NULL DEFAULT NULL, PRIMARY KEY (`Bankid`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`perk` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`perk` ( `Perkid` INT(11) NOT NULL, `Perkname` VARCHAR(45) NULL DEFAULT NULL, PRIMARY KEY (`Perkid`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`level` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`level` ( `Levelid` INT(11) NOT NULL, `Lname` VARCHAR(45) NULL DEFAULT NULL, PRIMARY KEY (`Levelid`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`ruser` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`ruser` ( `RUserid` INT(10) UNSIGNED NOT NULL, `Firstname` VARCHAR(45) NOT NULL, `Lastname` VARCHAR(45) NOT NULL, `DOB` DATE NOT NULL, `Age` INT(11) NOT NULL, `Category_Cid` INT(11) NULL, `bank_Bankid` INT(11) NULL, `perk_Perkid` INT(11) NULL, `level_Levelid` INT(11) NULL, PRIMARY KEY (`RUserid`), INDEX `fk_User_Category1_idx` (`Category_Cid` ASC) INVISIBLE, INDEX `fk_ruser_bank1_idx` (`bank_Bankid` ASC) VISIBLE, INDEX `fk_ruser_perk1_idx` (`perk_Perkid` ASC) VISIBLE, INDEX `fk_ruser_level1_idx` (`level_Levelid` ASC) VISIBLE, CONSTRAINT `fk_User_Category1` FOREIGN KEY (`Category_Cid`) REFERENCES `new1`.`category` (`Cid`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `fk_ruser_bank1` FOREIGN KEY (`bank_Bankid`) REFERENCES `new1`.`bank` (`Bankid`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `fk_ruser_perk1` FOREIGN KEY (`perk_Perkid`) REFERENCES `new1`.`perk` (`Perkid`) ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `fk_ruser_level1` FOREIGN KEY (`level_Levelid`) REFERENCES `new1`.`level` (`Levelid`) ON DELETE SET NULL ON UPDATE SET NULL) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`account` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`account` ( `Accountid` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `Email` VARCHAR(45) NOT NULL, `Paasword` VARCHAR(45) NOT NULL, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`Accountid`), INDEX `fk_account_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_account_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`paymethod` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`paymethod` ( `Payid` INT(11) NOT NULL AUTO_INCREMENT, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`Payid`), INDEX `fk_paymethod_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_paymethod_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`bankac` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`bankac` ( `paymethod_Payid` INT(11) NOT NULL, `BankACid` INT(11) NOT NULL, `Descrp` VARCHAR(45) NULL, PRIMARY KEY (`paymethod_Payid`), INDEX `fk_bankac_paymethod1_idx` (`paymethod_Payid` ASC) VISIBLE, CONSTRAINT `fk_bankac_paymethod1` FOREIGN KEY (`paymethod_Payid`) REFERENCES `new1`.`paymethod` (`Payid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`creditcard` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`creditcard` ( `paymethod_Payid` INT(11) NOT NULL, `CCid` INT(11) NOT NULL, `Descrp` VARCHAR(45) NULL, PRIMARY KEY (`paymethod_Payid`), INDEX `fk_creditcard_paymethod1_idx` (`paymethod_Payid` ASC) VISIBLE, CONSTRAINT `fk_creditcard_paymethod1` FOREIGN KEY (`paymethod_Payid`) REFERENCES `new1`.`paymethod` (`Payid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`days` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`days` ( `Daysid` INT(11) NOT NULL, `Stockid` INT(11) NULL DEFAULT NULL, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`Daysid`, `ruser_RUserid`), INDEX `fk_days_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_days_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`debitcard` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`debitcard` ( `paymethod_Payid` INT(11) NOT NULL, `DebitCardid` INT(11) NOT NULL, `Descrp` VARCHAR(45) NULL, PRIMARY KEY (`paymethod_Payid`), INDEX `fk_debitcard_paymethod1_idx` (`paymethod_Payid` ASC) VISIBLE, CONSTRAINT `fk_debitcard_paymethod1` FOREIGN KEY (`paymethod_Payid`) REFERENCES `new1`.`paymethod` (`Payid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`expert` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`expert` ( `Eid` INT(11) NOT NULL AUTO_INCREMENT, `ExpertName` VARCHAR(45) NOT NULL, `ruser_RUserid` INT(10) UNSIGNED NULL, PRIMARY KEY (`Eid`), INDEX `fk_expert_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_expert_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`friends` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`friends` ( `Friendid` INT(11) NOT NULL AUTO_INCREMENT, `Fname` TEXT NULL DEFAULT NULL, PRIMARY KEY (`Friendid`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`invite` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`invite` ( `Inviteid` INT(11) NOT NULL AUTO_INCREMENT, `Personname` VARCHAR(45) NULL DEFAULT NULL, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`Inviteid`, `ruser_RUserid`), INDEX `fk_invite_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_invite_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`stock` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`stock` ( `Stockid` INT(11) NOT NULL, `Stockvalue` INT(11) NOT NULL, `stockname` VARCHAR(45) NULL, PRIMARY KEY (`Stockid`)) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`wishlist` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`wishlist` ( `Wishlistid` INT(11) NOT NULL, `Stockid` INT(11) NOT NULL, `Wname` VARCHAR(45) NULL DEFAULT NULL, PRIMARY KEY (`Wishlistid`, `Stockid`), INDEX `fk_wishlist_stockid_idx` (`Stockid` ASC) VISIBLE, CONSTRAINT `fk_wishlist_stockid` FOREIGN KEY (`Stockid`) REFERENCES `new1`.`stock` (`Stockid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`maintain` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`maintain` ( `Maintainid` INT(11) NOT NULL AUTO_INCREMENT, `Wishlist_Wishlistid` INT(11) NOT NULL, `Wishlist_Stockid` INT(11) NOT NULL, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`Maintainid`, `Wishlist_Wishlistid`, `Wishlist_Stockid`), INDEX `fk_Maintain_Wishlist1_idx` (`Wishlist_Wishlistid` ASC, `Wishlist_Stockid` ASC) VISIBLE, INDEX `fk_maintain_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_Maintain_Wishlist1` FOREIGN KEY (`Wishlist_Wishlistid` , `Wishlist_Stockid`) REFERENCES `new1`.`wishlist` (`Wishlistid` , `Stockid`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_maintain_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`rating` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`rating` ( `Ratingid` INT(11) NOT NULL, `Ratingnumber` VARCHAR(45) NULL DEFAULT NULL, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`Ratingid`, `ruser_RUserid`), INDEX `fk_rating_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_rating_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`referral` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`referral` ( `Referralid` INT(11) NOT NULL, `Refferedname` VARCHAR(45) NULL DEFAULT NULL, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`Referralid`, `ruser_RUserid`), INDEX `fk_referral_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_referral_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`share` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`share` ( `Shareid` INT(11) NOT NULL, `Stockid` INT(11) NULL, `Friends_Friendid` INT(11) NOT NULL, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, PRIMARY KEY (`Shareid`), INDEX `fk_Share_Friends1_idx` (`Friends_Friendid` ASC) VISIBLE, INDEX `fk_share_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, CONSTRAINT `fk_Share_Friends1` FOREIGN KEY (`Friends_Friendid`) REFERENCES `new1`.`friends` (`Friendid`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_share_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; -- ----------------------------------------------------- -- Table `new1`.`Buying` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `new1`.`Buying` ( `paymethod_payid` INT NOT NULL, `Buydate` DATE NULL, `Description` VARCHAR(45) NULL, `stock_Stockid` INT(11) NOT NULL, `ruser_RUserid` INT(10) UNSIGNED NOT NULL, INDEX `fk_Buying_stock1_idx` (`stock_Stockid` ASC) VISIBLE, INDEX `fk_Buying_ruser1_idx` (`ruser_RUserid` ASC) VISIBLE, PRIMARY KEY (`paymethod_payid`), INDEX `fk_Buying_paymethod1_idx` (`paymethod_payid` ASC) INVISIBLE, CONSTRAINT `fk_Buying_stock1` FOREIGN KEY (`stock_Stockid`) REFERENCES `new1`.`stock` (`Stockid`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `fk_Buying_ruser1` FOREIGN KEY (`ruser_RUserid`) REFERENCES `new1`.`ruser` (`RUserid`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_Buying_paymethod1` FOREIGN KEY (`paymethod_payid`) REFERENCES `new1`.`paymethod` (`Payid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
true
f709e4d735924c8e9bb27376ce0337adfe93a771
SQL
malusoares0/chinook
/task_8_github.sql
UTF-8
375
3.8125
4
[]
no_license
-- Quantos atendimentos foram feitos por funcionário? -- How many calls were made per employee? SELECT e.EmployeeId AS funcionario_id, e.FirstName || " " || e.LastName AS nome_funcionario, COUNT(e.Title) AS n_atendimentos FROM Customer c JOIN Employee e ON c.SupportRepId=e.EmployeeId GROUP BY e.FirstName || " " || e.LastName ORDER BY c.FirstName || " " || c.LastName ;
true
5ff9ca11cf0b2c1d9f455c0ae346e216b91eac87
SQL
GianluigiMemoli/AskToReply
/Database/StoredProcedure/AddInteresseUtente.sql
UTF-8
387
2.796875
3
[]
no_license
use asktoreply; DELIMITER $$ CREATE PROCEDURE AddInteresseUtente( email VARCHAR(256), nomeCategoria VARCHAR(256) ) BEGIN SELECT id INTO @userId FROM Utenti WHERE Utenti.email = email; SELECT id INTO @categoriaId FROM Categorie WHERE Categorie.nome = nomeCategoria; INSERT INTO Interessi VALUES(@userId, @categoriaId); END $$
true
23c4be77c538422c809dfb6e4feff61eb843f768
SQL
tmlsergen/eComTez
/DB File Sql/eComfinal.sql
UTF-8
64,200
3.25
3
[]
no_license
-- -------------------------------------------------------- -- Host: 127.0.0.1 -- Server version: 5.7.23 - MySQL Community Server (GPL) -- Server OS: Linux -- HeidiSQL Version: 9.5.0.5332 -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- Dumping database structure for eCom DROP DATABASE IF EXISTS `eCom`; CREATE DATABASE IF NOT EXISTS `eCom` /*!40100 DEFAULT CHARACTER SET latin1 */; USE `eCom`; -- Dumping structure for table eCom.cart DROP TABLE IF EXISTS `cart`; CREATE TABLE IF NOT EXISTS `cart` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `products_id` int(11) NOT NULL, `product_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `product_code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `product_color` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `size` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `price` double(8,2) NOT NULL, `quantity` int(11) NOT NULL, `user_email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `session_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.cart: 0 rows /*!40000 ALTER TABLE `cart` DISABLE KEYS */; /*!40000 ALTER TABLE `cart` ENABLE KEYS */; -- Dumping structure for table eCom.categories DROP TABLE IF EXISTS `categories`; CREATE TABLE IF NOT EXISTS `categories` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `parent_id` int(11) DEFAULT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci, `url` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `status` tinyint(4) NOT NULL DEFAULT '0', `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `slug` (`name`) ) ENGINE=MyISAM AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.categories: 8 rows /*!40000 ALTER TABLE `categories` DISABLE KEYS */; INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (31, 25, 'Buz Dolabı', 'Buz', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:06:03', '2019-01-04 23:06:03'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (30, 25, 'Bulaşık Makinesi', 'bulaşık', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:05:44', '2019-01-04 23:06:11'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (29, 25, 'Ankastre', 'ankastre', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:05:21', '2019-01-04 23:05:21'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (28, 0, 'Tv - Ses ve Görüntü Sistemleri', 'TV', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:04:59', '2019-01-04 23:04:59'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (27, 0, 'Cep Telefonu ve Aksesuar', 'Cep Tel', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:04:40', '2019-01-04 23:04:40'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (26, 0, 'Bilgisayar', 'Bilgisayar', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:04:22', '2019-01-04 23:04:22'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (25, 0, 'Beyaz Eşya', 'Eşyalar', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:04:04', '2019-01-04 23:04:04'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (32, 26, 'Bilgisayar Bileşenleri', 'Bileşen', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:06:51', '2019-01-04 23:06:51'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (33, 26, 'Laptop', 'Dizüstü', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:07:38', '2019-01-04 23:07:38'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (34, 26, 'Masaüstü', 'Computer', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:08:00', '2019-01-04 23:08:00'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (35, 27, 'Apple', 'apple', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:08:47', '2019-01-04 23:08:47'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (36, 27, 'Samsung', 'asdasd', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:09:04', '2019-01-04 23:09:04'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (37, 27, 'Hafıza Kartı', 'asdasd', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:09:21', '2019-01-04 23:09:21'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (38, 28, 'Lg', 'asdasd', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:09:45', '2019-01-04 23:09:45'); INSERT INTO `categories` (`id`, `parent_id`, `name`, `description`, `url`, `status`, `remember_token`, `created_at`, `updated_at`) VALUES (39, 28, 'Regal', 'asdasd', 'https://github.com/tmlsergen/eComTez', 1, NULL, '2019-01-04 23:10:05', '2019-01-04 23:10:05'); /*!40000 ALTER TABLE `categories` ENABLE KEYS */; -- Dumping structure for table eCom.comments DROP TABLE IF EXISTS `comments`; CREATE TABLE IF NOT EXISTS `comments` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, `description` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, `products_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, `user_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.comments: ~0 rows (approximately) /*!40000 ALTER TABLE `comments` DISABLE KEYS */; /*!40000 ALTER TABLE `comments` ENABLE KEYS */; -- Dumping structure for table eCom.countries DROP TABLE IF EXISTS `countries`; CREATE TABLE IF NOT EXISTS `countries` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `country_code` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL, `country_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=298 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.countries: 253 rows /*!40000 ALTER TABLE `countries` DISABLE KEYS */; INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (2, 'AL', 'Arnavutluk', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (3, 'DZ', 'Cezayir', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (4, 'DS', 'Amerikan Samoası\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (5, 'AD', 'Andorra', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (6, 'AO', 'Angora', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (7, 'AI', 'Anguilla', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (8, 'AQ', 'Antarktika\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (9, 'AG', 'Antigua ve Barbuda\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (10, 'AR', 'Arjantin\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (11, 'AM', 'Ermenistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (12, 'AW', 'Aruba', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (13, 'AU', 'Avustralya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (14, 'AT', 'Avusturya\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (15, 'AZ', 'Azerbeycan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (16, 'BS', 'Bahamalar', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (17, 'BH', 'Bahreyn', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (18, 'BD', 'Bangladeş', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (19, 'BB', 'Barbados', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (20, 'BY', 'Belarus', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (21, 'BE', 'Belçika', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (22, 'BZ', 'Belize', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (23, 'BJ', 'Benin', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (24, 'BM', 'Bermuda', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (25, 'BT', 'Butan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (26, 'BO', 'Bolivya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (27, 'BA', 'Bosna Hersek\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (28, 'BW', 'Botsvana', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (29, 'BV', 'Bouvet Adası\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (30, 'BR', 'Brezilya\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (31, 'IO', 'İngiliz Hint Okyanusu Bölgesi\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (32, 'BN', 'Brunei Sultanlığı\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (33, 'BG', 'Bulgaristan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (34, 'BF', 'Burkina Faso', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (35, 'BI', 'Burundi', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (36, 'KH', 'Kamboçya\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (37, 'CM', 'Kamerun', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (38, 'CA', 'Kanada', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (39, 'CV', 'Cape Verde\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (40, 'KY', 'Cayman Adaları\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (41, 'CF', 'Orta Afrika Cumhuriyeti\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (42, 'TD', 'Çad', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (43, 'CL', 'Şili', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (44, 'CN', 'Çin', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (45, 'CX', 'Noel Adası\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (46, 'CC', 'Cocos Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (47, 'CO', 'Kolombiya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (48, 'KM', 'Komorlar', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (49, 'CG', 'Kongo', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (50, 'CK', 'Cook Adaları\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (51, 'CR', 'Kosta Rika\r\n', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (52, 'AF', 'Afganistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (96, 'CX', 'Noel Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (97, 'CC', 'Cocos Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (98, 'CO', 'Kolombiya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (99, 'KM', 'Komorlar', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (100, 'CG', 'Kongo', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (101, 'CK', 'Cook Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (102, 'CR', 'Costa Rica', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (103, 'HR', 'Hırvatistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (104, 'CU', 'Küba', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (105, 'CY', 'Kıbrıs', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (106, 'CZ', 'Çek Cumhuriyeti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (107, 'DK', 'Danimarka', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (108, 'DJ', 'Cibuti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (109, 'DM', 'Dominika', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (110, 'DO', 'Dominik Cumhuriyeti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (111, 'TP', 'Doğu Timor', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (112, 'EC', 'Ekvador', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (113, 'EG', 'Mısır', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (114, 'SV', 'El Salvador', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (115, 'GQ', 'Ekvator Ginesi', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (116, 'ER', 'Eritre', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (117, 'EE', 'Estonya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (118, 'ET', 'Etiyopya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (119, 'FK', 'Falkland Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (120, 'FO', 'Faroe Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (121, 'FJ', 'Fiji', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (122, 'FI', 'Finlandiya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (123, 'FR', 'Fransa', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (124, 'FX', 'Fransa, Büyükşehir', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (125, 'GF', 'Fransız Guyanası', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (126, 'PF', 'Fransız Polinezyası', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (127, 'TF', 'Fransız Güney Toprakları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (128, 'GA', 'Gabon', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (129, 'GM', 'Gambiya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (130, 'GE', 'Gürcistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (131, 'DE', 'Almanya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (132, 'GH', 'Gana', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (133, 'GI', 'Cebelitarık', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (134, 'GK', 'Guernsey', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (135, 'GR', 'Yunanistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (136, 'GL', 'Grönland', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (137, 'GD', 'Grenada', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (138, 'GP', 'Guadeloupe', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (139, 'GU', 'Guam', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (140, 'GT', 'Guatemala', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (141, 'GN', 'Gine', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (142, 'GW', 'Guinea-Bissau', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (143, 'GY', 'Guyana', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (144, 'HT', 'Haiti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (145, 'HM', 'Heard ve Mcdonald Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (146, 'HN', 'Honduras', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (147, 'HK', 'Hong Kong', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (148, 'HU', 'Macaristan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (149, 'IS', 'İzlanda', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (150, 'IN', 'Hindistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (151, 'IM', 'Isle of Man', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (152, 'ID', 'Endonezya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (153, 'IR', 'İran', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (154, 'IQ', 'Irak', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (155, 'IE', 'İrlanda', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (156, 'IL', 'İsrail', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (157, 'IT', 'İtalya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (158, 'CI', 'Fildişi Sahili', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (159, 'JE', 'Jersey', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (160, 'JM', 'Jamaika', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (161, 'JP', 'Japonya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (162, 'JO', 'Ürdün', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (163, 'KZ', 'Kazakistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (164, 'KE', 'Kenya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (165, 'KI', 'Kiribati', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (166, 'KP', 'Kore Demokratik Halk Cumhuriyeti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (167, 'KR', 'Kore Cumhuriyeti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (168, 'XK', 'Kosova', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (169, 'KW', 'Kuveyt', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (170, 'KG', 'Kırgızistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (171, 'LA', 'Lao Demokratik Halk Cumhuriyeti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (172, 'LV', 'Letonya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (173, 'LB', 'Lübnan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (174, 'LS', 'Lesotho', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (175, 'LR', 'Liberya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (176, 'LY', 'Libya Arap Jamahiriya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (177, 'LI', 'Lihtenştayn', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (178, 'LT', 'Litvanya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (179, 'LU', 'Lüksemburg', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (180, 'MO', 'Makao', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (181, 'MK', 'Makedonya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (182, 'MG', 'Madagaskar', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (183, 'MW', 'Malawi', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (184, 'MY', 'Malezya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (185, 'MV', 'Maldivler', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (186, 'ML', 'Mali', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (187, 'MT', 'Malta', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (188, 'MH', 'Marşal Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (189, 'MQ', 'Martinik', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (190, 'MR', 'Moritanya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (191, 'MU', 'Mauritius', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (192, 'TY', 'Mayotte', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (193, 'MX', 'Meksika', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (194, 'FM', 'Mikronezya Federal Devletleri', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (195, 'MD', 'Moldova Cumhuriyeti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (196, 'MC', 'Monako', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (197, 'MN', 'Moğolistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (198, 'ME', 'Karadağ', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (199, 'MS', 'Montserrat', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (200, 'MA', 'Fas', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (201, 'MZ', 'Mozambik', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (202, 'MM', 'Myanmar', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (203, 'NA', 'Namibya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (204, 'NR', 'Nauru', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (205, 'NP', 'Nepal', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (206, 'NL', 'Hollanda', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (207, 'AN', 'Hollanda Antilleri', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (208, 'NC', 'Yeni Kaledonya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (209, 'NZ', 'Yeni Zelanda', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (210, 'NI', 'Nikaragua', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (211, 'NE', 'Nijer', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (212, 'NG', 'Nijerya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (213, 'NU', 'Niue', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (214, 'NF', 'Norfolk Adası', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (215, 'MP', 'Kuzey Mariana Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (216, 'NO', 'Norveç', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (217, 'OM', 'Umman', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (218, 'PK', 'Pakistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (219, 'PW', 'Palau', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (220, 'PS', 'Filistin', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (221, 'PA', 'Panama', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (222, 'PG', 'Papua Yeni Gine', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (223, 'PY', 'Paraguay', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (224, 'PE', 'Peru', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (225, 'PH', 'Filipinler', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (226, 'PN', 'Pitcairn', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (227, 'PL', 'Polonya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (228, 'PT', 'Portekiz', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (229, 'PR', 'Porto Rico', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (230, 'QA', 'Katar', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (231, 'RE', 'Reunion', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (232, 'RO', 'Romanya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (233, 'RU', 'Rusya Federasyonu', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (234, 'RW', 'Rwanda', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (235, 'KN', 'Saint Kitts and Nevis', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (236, 'LC', 'Saint Lucia', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (237, 'VC', 'Saint Vincent and the Grenadines', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (238, 'WS', 'Samoa', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (239, 'SM', 'San Marino', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (240, 'ST', 'Sao Tome and Principe', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (241, 'SA', 'Suudi Arabistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (242, 'SN', 'Senegal', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (243, 'RS', 'Sırbistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (244, 'SC', 'Seyşeller', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (245, 'SL', 'Sierra Leone', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (246, 'SG', 'Singapur', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (247, 'SK', 'Slovakya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (248, 'SI', 'Slovenya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (249, 'SB', 'Solomon Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (250, 'SO', 'Somali', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (251, 'ZA', 'Güney Africa', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (252, 'GS', 'Güney Georgia Güney Sandwich Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (253, 'SS', 'Güney Sudan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (254, 'ES', 'İspanya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (255, 'LK', 'Sri Lanka', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (256, 'SH', 'Aziz Helena', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (257, 'PM', 'St. Pierre and Miquelon', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (258, 'SD', 'Sudan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (259, 'SR', 'Surinam', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (260, 'SJ', 'Svalbard ve Jan Mayen Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (261, 'SZ', 'Svaziland', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (262, 'SE', 'İsveç', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (263, 'CH', 'İsviçre', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (264, 'SY', 'Suriye Arap Cumhuriyeti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (265, 'TW', 'Tayvan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (266, 'TJ', 'Tacikistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (267, 'TZ', 'Tanzanya, Birleşik Cumhuriyeti', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (268, 'TH', 'Tayland', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (269, 'TG', 'Togo', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (270, 'TK', 'Tokelau', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (271, 'TO', 'Tonga', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (272, 'TT', 'Trinidad and Tobago', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (273, 'TN', 'Tunus', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (274, 'TR', 'Türkiye', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (275, 'TM', 'Türkmenistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (276, 'TC', 'Turks ve Caicos Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (277, 'TV', 'Tuvalu', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (278, 'UG', 'Uganda', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (279, 'UA', 'Ukrayna', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (280, 'AE', 'Birleşik Arap Emirlikleri', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (281, 'GB', 'Birleşik Krallık', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (282, 'US', 'Amerika Birleşik Devletleri', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (283, 'UM', 'Amerika Birleşik Devletleri Küçük Dış Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (284, 'UY', 'Uruguay', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (285, 'UZ', 'Özbekistan', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (286, 'VU', 'Vanuatu', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (287, 'VA', 'Vatikan Şehir Devletleri', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (288, 'VE', 'Venezuela', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (289, 'VN', 'Vietnam', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (290, 'VG', 'Virgin Adaları (İngiltere)', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (291, 'VI', 'Virgin Islands (ABD)', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (292, 'WF', 'Wallis ve Futuna Adaları', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (293, 'EH', 'Batı Sahra', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (294, 'YE', 'Yemen', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (295, 'ZR', 'Zaire', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (296, 'ZM', 'Zambiya', NULL, NULL); INSERT INTO `countries` (`id`, `country_code`, `country_name`, `created_at`, `updated_at`) VALUES (297, 'ZW', 'Zimbabve', NULL, NULL); /*!40000 ALTER TABLE `countries` ENABLE KEYS */; -- Dumping structure for table eCom.coupons DROP TABLE IF EXISTS `coupons`; CREATE TABLE IF NOT EXISTS `coupons` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `coupon_code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `amount` int(11) NOT NULL, `amount_type` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `expiry_date` date NOT NULL, `status` tinyint(4) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.coupons: 0 rows /*!40000 ALTER TABLE `coupons` DISABLE KEYS */; INSERT INTO `coupons` (`id`, `coupon_code`, `amount`, `amount_type`, `expiry_date`, `status`, `created_at`, `updated_at`) VALUES (7, 'Coupon001', 43, 'Percentage', '2052-06-06', 1, '2019-01-04 23:53:17', '2019-01-04 23:53:17'); /*!40000 ALTER TABLE `coupons` ENABLE KEYS */; -- Dumping structure for table eCom.delivery_address DROP TABLE IF EXISTS `delivery_address`; CREATE TABLE IF NOT EXISTS `delivery_address` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `users_id` int(11) NOT NULL, `users_email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `address` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `city` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `state` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `country` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `pincode` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `mobile` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.delivery_address: 2 rows /*!40000 ALTER TABLE `delivery_address` DISABLE KEYS */; INSERT INTO `delivery_address` (`id`, `users_id`, `users_email`, `name`, `address`, `city`, `state`, `country`, `pincode`, `mobile`, `created_at`, `updated_at`) VALUES (2, 4, 'weshare@gmail.com', 'weshare', 'address', 'city', 'state', 'Cambodia', 'pincode', 'mobile', NULL, NULL); INSERT INTO `delivery_address` (`id`, `users_id`, `users_email`, `name`, `address`, `city`, `state`, `country`, `pincode`, `mobile`, `created_at`, `updated_at`) VALUES (3, 1, 'demo@gmail.com', 'Sergen Temel', 'İstanbul, İstanbul', 'İstanbul', 'İstanbul', 'Turkey', '34196', '5054702896', NULL, NULL); /*!40000 ALTER TABLE `delivery_address` ENABLE KEYS */; -- Dumping structure for table eCom.migrations DROP TABLE IF EXISTS `migrations`; CREATE TABLE IF NOT EXISTS `migrations` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `migration` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `batch` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.migrations: 12 rows /*!40000 ALTER TABLE `migrations` DISABLE KEYS */; INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (3, '2014_10_12_000000_create_users_table', 2); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (2, '2014_10_12_100000_create_password_resets_table', 1); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (8, '2018_10_20_040609_create_categories_table', 3); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (9, '2018_10_24_075802_create_products_table', 4); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (10, '2018_11_08_024109_create_product_att_table', 5); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (11, '2018_11_20_055123_create_tblgallery_table', 6); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (12, '2018_11_26_070031_create_cart_table', 7); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (13, '2018_11_28_072535_create_coupons_table', 8); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (15, '2018_12_01_042342_create_countries_table', 10); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (19, '2018_12_03_043804_add_more_fields_to_users_table', 14); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (17, '2018_12_03_093548_create_delivery_address_table', 12); INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (18, '2018_12_05_024718_create_orders_table', 13); /*!40000 ALTER TABLE `migrations` ENABLE KEYS */; -- Dumping structure for table eCom.orders DROP TABLE IF EXISTS `orders`; CREATE TABLE IF NOT EXISTS `orders` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `users_id` int(11) NOT NULL, `users_email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `address` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `city` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `state` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `pincode` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `country` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `mobile` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `shipping_charges` double(8,2) NOT NULL DEFAULT '0.00', `coupon_code` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `coupon_amount` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `order_status` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `payment_method` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `grand_total` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=39 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.orders: 8 rows /*!40000 ALTER TABLE `orders` DISABLE KEYS */; /*!40000 ALTER TABLE `orders` ENABLE KEYS */; -- Dumping structure for table eCom.password_resets DROP TABLE IF EXISTS `password_resets`; CREATE TABLE IF NOT EXISTS `password_resets` ( `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `token` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, KEY `password_resets_email_index` (`email`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.password_resets: 0 rows /*!40000 ALTER TABLE `password_resets` DISABLE KEYS */; /*!40000 ALTER TABLE `password_resets` ENABLE KEYS */; -- Dumping structure for table eCom.products DROP TABLE IF EXISTS `products`; CREATE TABLE IF NOT EXISTS `products` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `categories_id` int(11) NOT NULL, `p_name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `p_code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `p_color` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `description` text COLLATE utf8mb4_unicode_ci NOT NULL, `price` double(8,2) NOT NULL, `image` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=51 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.products: 9 rows /*!40000 ALTER TABLE `products` DISABLE KEYS */; INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (46, 31, 'Simens Buz Dolabı', 'simo5957', 'Beyaz', 'Büyük Buz Dolabı 5 kapılı', 453.00, '1546645614-simens-buz-dolabi.jpg', '2019-01-04 23:46:54', '2019-01-04 23:46:54'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (47, 31, 'Vestel Buzdolabı', 'ves4569', 'Beyaz', 'Uygun Fiyata Buz Dolabı A+ enerji&nbsp;', 150.00, '1546645699-vestel-buzdolabi.jpg', '2019-01-04 23:48:20', '2019-01-04 23:48:20'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (43, 33, 'Asus Rog', '12341652', 'Mavi', 'i7 gtx 1050', 888.00, '1546645259-asus-rog.jpg', '2019-01-04 23:40:59', '2019-01-04 23:40:59'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (44, 33, 'Dell İnspiron', '123132132132', 'Siyah', 'i7 1050ti gtx<br>128 ssd 1 tb hdd', 1258.00, '1546645399-dell-inspiron.jpg', '2019-01-04 23:43:19', '2019-01-04 23:43:19'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (45, 34, 'Naggas', 'nigga15896', 'Mavi', 'Kasa', 986.00, '1546645499-naggas.jpg', '2019-01-04 23:44:59', '2019-01-04 23:44:59'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (42, 32, 'İşlemci AMD', 'ryzo1235', 'Altın', '3GHZ işlemci', 550.00, '1546645209-islemci-amd.jpg', '2019-01-04 23:40:10', '2019-01-04 23:40:10'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (41, 32, 'Asus Batarya', 'as54865', 'Siyah', 'Asus Batarya', 65.00, '1546645128-asus-batarya.jpg', '2019-01-04 23:38:48', '2019-01-04 23:38:48'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (40, 37, 'Samsung Hafıza Kartı', '124565214', 'Siyah', '32GB Hafıza Kartı', 15.00, '1546645056-samsung-hafiza-karti.jpg', '2019-01-04 23:37:36', '2019-01-04 23:37:36'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (39, 36, 'Galaxy Note 9', 'note 9', 'Yeşil', 'Galaksi not 9', 190.00, '1546644979-galaxy-note-9.jpg', '2019-01-04 23:36:19', '2019-01-04 23:36:19'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (38, 35, 'iPhone X', 'x123456', 'Yeşil', 'Ayfon X', 150.00, '1546644779-iphone-x.jpg', '2019-01-04 23:32:59', '2019-01-04 23:32:59'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (37, 39, 'Regal 32R', '32R4020H', 'Mavi', 'Regal TV', 150.00, '1546644704-regal-32r.jpg', '2019-01-04 23:31:45', '2019-01-04 23:31:45'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (36, 38, 'Lg 43LK', '43LK5900', 'Siyah', '<b>LG</b> TELEVİZYON', 150.00, '1546644519-lg-43lk.jpg', '2019-01-04 23:28:39', '2019-01-04 23:28:39'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (48, 31, 'Vestel Buzdolabı', 'ves4569', 'Beyaz', 'Uygun Fiyata Buz Dolabı A+ enerji&nbsp;', 150.00, '1546645699-vestel-buzdolabi.jpg', '2019-01-04 23:48:20', '2019-01-04 23:48:20'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (49, 30, 'Bosh Programlı Makine', 'bosh87654', 'Pembe', 'Pempe Buz Dolabı Görünümlü Bulaşık makinesi', 888.00, '1546645837-bosh-programli-makine.jpg', '2019-01-04 23:50:37', '2019-01-04 23:50:37'); INSERT INTO `products` (`id`, `categories_id`, `p_name`, `p_code`, `p_color`, `description`, `price`, `image`, `created_at`, `updated_at`) VALUES (50, 29, 'Hoover Ankastre Set', 'hovo4897', 'Siyah', 'Kullanışlı uygun fiyatlı', 4521.00, '1546645913-hoover-ankastre-set.jpg', '2019-01-04 23:51:53', '2019-01-04 23:51:53'); /*!40000 ALTER TABLE `products` ENABLE KEYS */; -- Dumping structure for table eCom.product_att DROP TABLE IF EXISTS `product_att`; CREATE TABLE IF NOT EXISTS `product_att` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `products_id` int(11) NOT NULL, `sku` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `size` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `price` double(8,2) NOT NULL, `stock` int(11) NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.product_att: 24 rows /*!40000 ALTER TABLE `product_att` DISABLE KEYS */; INSERT INTO `product_att` (`id`, `products_id`, `sku`, `size`, `price`, `stock`, `created_at`, `updated_at`) VALUES (37, 44, '123132132132', 'Small', 88.00, 150, '2019-01-04 23:44:01', '2019-01-04 23:44:01'); INSERT INTO `product_att` (`id`, `products_id`, `sku`, `size`, `price`, `stock`, `created_at`, `updated_at`) VALUES (36, 38, 'x123456', 'Big', 88.00, 150, '2019-01-04 23:33:40', '2019-01-04 23:33:40'); INSERT INTO `product_att` (`id`, `products_id`, `sku`, `size`, `price`, `stock`, `created_at`, `updated_at`) VALUES (35, 36, '43LK5900', 'Big', 99.00, 150, '2019-01-04 23:30:19', '2019-01-04 23:30:19'); /*!40000 ALTER TABLE `product_att` ENABLE KEYS */; -- Dumping structure for table eCom.tblgallery DROP TABLE IF EXISTS `tblgallery`; CREATE TABLE IF NOT EXISTS `tblgallery` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `products_id` int(11) NOT NULL, `image` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.tblgallery: 27 rows /*!40000 ALTER TABLE `tblgallery` DISABLE KEYS */; INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (60, 50, '8901831546645928.jpg', '2019-01-04 23:52:09', '2019-01-04 23:52:09'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (59, 50, '955771546645928.jpg', '2019-01-04 23:52:08', '2019-01-04 23:52:08'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (58, 50, '784841546645927.jpg', '2019-01-04 23:52:08', '2019-01-04 23:52:08'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (57, 49, '9835531546645847.jpg', '2019-01-04 23:50:48', '2019-01-04 23:50:48'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (56, 46, '1771291546645626.jpg', '2019-01-04 23:47:06', '2019-01-04 23:47:06'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (55, 46, '4255831546645626.jpg', '2019-01-04 23:47:06', '2019-01-04 23:47:06'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (54, 46, '3619321546645626.jpg', '2019-01-04 23:47:06', '2019-01-04 23:47:06'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (53, 46, '1038221546645626.jpg', '2019-01-04 23:47:06', '2019-01-04 23:47:06'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (52, 46, '4435241546645626.jpg', '2019-01-04 23:47:06', '2019-01-04 23:47:06'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (51, 45, '5891671546645510.jpg', '2019-01-04 23:45:10', '2019-01-04 23:45:10'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (50, 45, '8300501546645510.jpg', '2019-01-04 23:45:10', '2019-01-04 23:45:10'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (49, 45, '5547441546645510.jpg', '2019-01-04 23:45:10', '2019-01-04 23:45:10'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (48, 44, '3304951546645420.jpg', '2019-01-04 23:43:40', '2019-01-04 23:43:40'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (47, 44, '7028511546645420.jpg', '2019-01-04 23:43:40', '2019-01-04 23:43:40'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (46, 44, '9252381546645420.jpg', '2019-01-04 23:43:40', '2019-01-04 23:43:40'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (45, 41, '8162011546645143.jpg', '2019-01-04 23:39:04', '2019-01-04 23:39:04'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (44, 41, '9939941546645143.jpg', '2019-01-04 23:39:03', '2019-01-04 23:39:03'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (43, 40, '3788831546645073.jpg', '2019-01-04 23:37:53', '2019-01-04 23:37:53'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (42, 40, '5809311546645073.jpg', '2019-01-04 23:37:53', '2019-01-04 23:37:53'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (41, 40, '2777151546645073.jpg', '2019-01-04 23:37:53', '2019-01-04 23:37:53'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (40, 38, '1054671546644795.jpg', '2019-01-04 23:33:16', '2019-01-04 23:33:16'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (39, 38, '4815621546644795.jpg', '2019-01-04 23:33:15', '2019-01-04 23:33:15'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (38, 37, '5852891546644728.jpg', '2019-01-04 23:32:08', '2019-01-04 23:32:08'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (37, 37, '4364831546644728.jpg', '2019-01-04 23:32:08', '2019-01-04 23:32:08'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (36, 37, '5836691546644727.jpg', '2019-01-04 23:32:08', '2019-01-04 23:32:08'); INSERT INTO `tblgallery` (`id`, `products_id`, `image`, `created_at`, `updated_at`) VALUES (35, 36, '9867451546644637.jpg', '2019-01-04 23:30:38', '2019-01-04 23:30:38'); /*!40000 ALTER TABLE `tblgallery` ENABLE KEYS */; -- Dumping structure for table eCom.users DROP TABLE IF EXISTS `users`; CREATE TABLE IF NOT EXISTS `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `email_verified_at` timestamp NULL DEFAULT NULL, `password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL, `admin` tinyint(4) DEFAULT NULL, `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `created_at` timestamp NULL DEFAULT NULL, `updated_at` timestamp NULL DEFAULT NULL, `address` text COLLATE utf8mb4_unicode_ci, `city` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `state` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `country` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `pincode` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `mobile` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `users_email_unique` (`email`) ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Dumping data for table eCom.users: 2 rows /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `admin`, `remember_token`, `created_at`, `updated_at`, `address`, `city`, `state`, `country`, `pincode`, `mobile`) VALUES (1, 'Sergen Temel', 'tmlsergen@gmail.com', NULL, '$2a$10$aEE3WfpfTp8ntvnaHN23c.8mJ9iL5eeqKVf/EmhAhPAdoZ6x9SBKi', 1, 'QnE5GTDq1wLqMG8c2ct74quXX1xZLSnz2QrPHW3ei0N2869y7ja8uXUe3wp5', '2018-10-15 05:32:54', '2018-12-05 04:39:52', 'İstanbul, İstanbul', 'İstanbul', 'İstanbul', 'Türkiye', '34196', '5054702896'); INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `admin`, `remember_token`, `created_at`, `updated_at`, `address`, `city`, `state`, `country`, `pincode`, `mobile`) VALUES (4, 'Onur Sezer', 'onrsezer15@gmail.com', NULL, '$2a$10$aEE3WfpfTp8ntvnaHN23c.8mJ9iL5eeqKVf/EmhAhPAdoZ6x9SBKi', NULL, '5iuZaXcYDA7Qg8g4KdQ8X2iAsMmzqlEkyX7X9Xtrj9x0WaiPdwGTacidzD5z', '2018-12-06 04:40:27', '2018-12-06 04:40:27', 'İstanbul, İstanbul', 'İstanbul', 'İstanbul', 'Türkiye', '34196', '5054702896'); /*!40000 ALTER TABLE `users` ENABLE KEYS */; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
true
ef502078c3c2418cfee5fcc1fc911560ba5c8d39
SQL
johnwongca/Analysis
/Analysis/Quote/q/Stored Procedures/q.UpdateAlgorithm.sql
UTF-8
388
2.96875
3
[]
no_license
CREATE procedure [q].[UpdateAlgorithm] ( @AlgorithmName varchar(128), @Class varchar(256), @Description varchar(max) ) as begin set nocount on update q.Algorithm set Class = @Class, Description = @Description where AlgorithmName = @AlgorithmName if @@rowcount = 0 insert into q.Algorithm(AlgorithmName, Class, Description) values(@AlgorithmName, @Class, @Description) end
true
339177fea62033c75e8682eda1124e429bf337a8
SQL
ppedvAG/Turbo_SQL_Grundlagen_VC_2021_01_29
/2021_01_29_Turbo_SQL_Grundlagen/2021_01_29_Turbo_SQL_Grundlagen/005_ Wildcards.sql
ISO-8859-1
2,225
3.84375
4
[]
no_license
-- WILDCARDS beim LIKE -- % steht fr beliebig viele unbekannte Zeichen (0 - ?) -- Wertebereiche [] -- steht fr genau 1 Zeichen in einem bestimmten Bereich -- funktioniert auch mit Sonderzeichen -- funktioniert fr 'von-bis' [a-c] -- _ beim LIKE - genau 1 unbekanntes Zeichen -- *************************************** % ************************************************ -- alle Kunden, deren KundenID mit 'ALF' beginnt USE Northwind; SELECT * FROM Customers WHERE CustomerID LIKE 'ALF%' -- alle Kunden, deren KundenID mit 'MI' endet SELECT * FROM Customers WHERE CustomerID LIKE '%MI' -- alle Kunden, die IRGENDWO im Namen 'kist' haben SELECT * FROM Customers WHERE CompanyName LIKE '%kist%' -- alle, deren Firmenname mit D beginnt SELECT * FROM Customers WHERE CompanyName LIKE 'D%' -- alle, die mit D enden SELECT * FROM Customers WHERE CompanyName LIKE '%D' -- alle, die ein D enthalten SELECT * FROM Customers WHERE CompanyName LIKE '%D%' -- *************************************** [] *********************************************** -- alle, die mit a, b oder c beginnen SELECT * FROM Customers WHERE CompanyName LIKE '[a-c]%' -- alle, die mit a oder c beginnen -- entweder so: SELECT * FROM Customers WHERE CompanyName LIKE 'a%' OR CompanyName LIKE 'c%' -- oder so: SELECT * FROM Customers WHERE CompanyName LIKE '[ac]%' -- alle Produkte, die mit M, N oder S beginnen? SELECT * FROM Products WHERE ProductName LIKE '[mns]%' -- order by: SELECT * FROM Products WHERE ProductName LIKE '[mns]%' ORDER BY ProductName -- *************************************** _ ************************************************ -- wie bekommt man eine Ausgabe mit einem unbekannten Zeichen: -- vorletztes Zeichen unbekannt: SELECT * FROM Customers WHERE Phone LIKE '(5) 555-47[0-9]9' -- oder: SELECT * FROM Customers WHERE Phone LIKE '(5) 555-47_9' -- _ (Unterstrich) steht fr genau 1 unbekanntes Zeichen -- fr die Profis: -- alle Kunden, die mit d, e oder f beginnen, der letzte Buchstabe ist ein l und der drittletzte ein d SELECT * FROM Customers WHERE CompanyName LIKE '[d-f]%d_l' /* mgliche Ergebnisse z.B. ddxl edel fxxxxxxxxxdxl Ernst Handel (in Northwind DB Customers) E........d.l */
true
12505e9799d59da78ed843e4a931d71dcac5ebec
SQL
azuki-framework/azuki-grep
/src/test/resource/sql/SELECT01.sql
UTF-8
628
3.375
3
[ "Apache-2.0" ]
permissive
-- subquery_factoring_clause SELECT /*+ hind */ DISTINCT column1 , column2 FROM table1 , ( SELECT UNIQUE column1 , column2 FROM table4 ) table2 , ( SELECT ALL column1 , column2 FROM table5 ) table3 GROUP BY column1 , column2 ORDER SIBLINGS BY column1 , column2 ASC , column3 DESC , column4 NULLS FIRST , column5 NULLS LAST , column6 ASC NULLS FIRST , column7 DESC NULLS LAST FOR UPDATE schema1.table1.column1 , table1.column1 , column1 WAIT 10
true
2dcf096acd46471442be9cd7e860fcc4ea70ad4c
SQL
dominik-kutrowski/ListTuDu
/src/main/resources/List_Tu_Du.mysql
UTF-8
4,528
2.859375
3
[]
no_license
-- MySQL dump 10.13 Distrib 8.0.18, for Win64 (x86_64) -- -- Host: localhost Database: List_Tu_Du -- ------------------------------------------------------ -- Server version 8.0.18 /*!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 */; /*!50503 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -- -- Table structure for table `hibernate_sequence` -- DROP TABLE IF EXISTS `hibernate_sequence`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `hibernate_sequence` ( `next_val` bigint(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `hibernate_sequence` -- LOCK TABLES `hibernate_sequence` WRITE; /*!40000 ALTER TABLE `hibernate_sequence` DISABLE KEYS */; INSERT INTO `hibernate_sequence` VALUES (2); /*!40000 ALTER TABLE `hibernate_sequence` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `task` -- DROP TABLE IF EXISTS `task`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `task` ( `id` int(10) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `status` enum('NotStarted','InProgress','Completed') NOT NULL, `date_dead_line` date DEFAULT NULL, `created_by` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=95 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `task` -- LOCK TABLES `task` WRITE; /*!40000 ALTER TABLE `task` DISABLE KEYS */; INSERT INTO `task` VALUES (1,'zadanie no. 1','NotStarted','2019-08-02','d@d.com'),(2,'task no. 2','NotStarted','2019-07-30','m@m.com'),(3,'first real task!','NotStarted','2019-07-20','m@m.com'),(4,'second real task!','NotStarted','2019-07-30','d@d.com'),(5,'first task from boss!','NotStarted','2019-08-02','m@m.com'),(6,'second task from boss!','NotStarted','2020-02-02','m@m.com'),(7,'third task from boss!','NotStarted','2020-02-02','m@m.com'),(9,'pierwszy durny task!','NotStarted','2020-02-02','d@d.com'),(10,'pierwszy durny task nowego szefa!!','NotStarted','2020-02-02','d@d.com'),(11,'zwalniam sie!!','NotStarted','2020-02-02','d@d.com'),(54,'task test 13','NotStarted','2019-08-03','d@d.com'),(56,'task test In Progress','NotStarted',NULL,'d@d.com'),(94,'Add creators for previous tasks!!','InProgress','2020-01-01','d@d.com'); /*!40000 ALTER TABLE `task` ENABLE KEYS */; UNLOCK TABLES; -- -- Table structure for table `user_login` -- DROP TABLE IF EXISTS `user_login`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!50503 SET character_set_client = utf8mb4 */; CREATE TABLE `user_login` ( `user_login_id` int(10) NOT NULL AUTO_INCREMENT, `user_login_email` varchar(256) NOT NULL, `user_login_pass` varchar(64) NOT NULL, `user_login_role` enum('User','SuperUser','Root') NOT NULL, PRIMARY KEY (`user_login_id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- -- Dumping data for table `user_login` -- LOCK TABLES `user_login` WRITE; /*!40000 ALTER TABLE `user_login` DISABLE KEYS */; INSERT INTO `user_login` VALUES (1,'m@m.com','$2a$10$ptfR9e5h6cY1PHl1UrHxi.q/5T05sjRgf.uGBOqOnEVK650HDGo72','USER'),(2,'d@d.com','$2a$10$qd4o6l6ukSHHupyV8WbGUOXDMShGqcR3jc7aLcTLy9N1fNYYJ.r76','USER'); /*!40000 ALTER TABLE `user_login` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -- Dump completed on 2019-12-04 23:26:37
true
5e6c5e7f5164b1577249d5eb33a416fe4daf3d5e
SQL
LAmor0214/programmer_community
/src/main/resources/db/migration/V1__Create_user_table.sql
UTF-8
1,452
3.171875
3
[]
no_license
CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', `username` varchar(50) DEFAULT NULL COMMENT '用户名', `password` varchar(20) DEFAULT NULL COMMENT '密码', `nickname` varchar(50) DEFAULT NULL COMMENT '昵称', `gender` tinyint(4) DEFAULT '0' COMMENT '性别(0:男;1:女)', `phono_url` varchar(255) DEFAULT NULL COMMENT '头像地址', `city` varchar(255) DEFAULT NULL COMMENT '所在城市', `phone` char(11) DEFAULT NULL COMMENT '手机号码', `email` varchar(50) DEFAULT NULL COMMENT '邮箱', `birthday` date DEFAULT NULL COMMENT '出生日期', `emotional_state` tinyint(4) DEFAULT NULL COMMENT '情感状况(0:单身;1:热恋;2:已婚;3:保密)', `hobby_tags` varchar(255) DEFAULT NULL COMMENT '爱好标签', `education` varchar(20) DEFAULT NULL COMMENT '学历', `school` varchar(50) DEFAULT NULL COMMENT '学校', `sign` varchar(255) DEFAULT NULL COMMENT '个性签名', `accumulated_points` int(11) DEFAULT '0' COMMENT '累计积分', `y_currency` int(11) DEFAULT '0' COMMENT 'Y币', `level` tinyint(4) DEFAULT '1' COMMENT '等级', `role` tinyint(4) DEFAULT '0' COMMENT '角色(0:普通用户)', `status` tinyint(4) DEFAULT '0' COMMENT '状态(0:正常;1:注销;2:黑户)', `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
true
1146526f691b758c7cca3bc7ae2abeddd81fd321
SQL
micaiah-buttars/sql-2-afternoon
/SQL II/delete_rows.sql
UTF-8
1,115
2.6875
3
[]
no_license
-- DUMMY DATA -- CREATE TABLE practice_delete ( name TEXT, type TEXT, value INTEGER ); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'bronze', 50); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'bronze', 50); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'bronze', 50); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'silver', 100); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'silver', 100); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'gold', 150); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'gold', 150); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'gold', 150); -- INSERT INTO practice_delete ( name, type, value ) VALUES ('delete', 'gold', 150); -- SELECT * FROM practice_delete; -- DELETE ROWS 1 -- delete from practice_delete -- where type = 'bronze' -- DELETE ROWS 2 -- delete from practice_delete -- where type = 'silver' -- DELETE ROWS 3 -- delete from practice_delete -- where value = 150
true
991f36e40ddc028f60717b8987418e494afbe3aa
SQL
sujitrai/Anguler-Bootstrap-node
/myDB.sql
UTF-8
1,656
2.796875
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 3.4.10.1deb1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Sep 14, 2015 at 04:20 PM -- Server version: 5.5.44 -- PHP Version: 5.3.10-1ubuntu3.19 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 utf8 */; -- -- Database: `myDB` -- -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE IF NOT EXISTS `users` ( `email` varchar(50) NOT NULL DEFAULT '', `name` varchar(50) DEFAULT NULL, `type` varchar(500) DEFAULT NULL, `password` varchar(50) DEFAULT NULL, `skills` varchar(500) NOT NULL, `employer` varchar(50) NOT NULL, PRIMARY KEY (`email`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`email`, `name`, `type`, `password`, `skills`, `employer`) VALUES ('abc@xyz.com', 'abc xyz', 'candidate', 'a9993e364706816aba3e25717850c26c9cd0d89d', 'javascript,hadoop,.net', '---'), ('ac@jfkjjrr.com', 'pavan kumar', 'candidate', '87d8a17a753ed3949de363a7a1322291bf7290d7', 'DS,js', ''), ('pavak@gmail.com', 'pavan kumar', 'candidate', '87d8a17a753ed3949de363a7a1322291bf7290d7', 'DS,js', 'sujit--'), ('sujitrai.09@gmail.com', 'sujit', 'admin', '87d8a17a753ed3949de363a7a1322291bf7290d7', 'javascript,hadoop', ''); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
b12f96ad038ab3c893e3d2baa4470bed7346b437
SQL
the-night-wing/SQL_the_vets_clinic
/queries/select_procedures_matched_to_details.sql
UTF-8
104
2.8125
3
[]
no_license
SELECT * FROM procedures_history LEFT JOIN procedures_details USING (procedure_type, procedure_subcode)
true
5955c85482f638855cc6edbd9374fe5a5f083d71
SQL
julianurregoar/apollo-server-and-prisma
/prisma/migrations/20210215020723_init/migration.sql
UTF-8
305
3.609375
4
[]
no_license
-- CreateTable CREATE TABLE "Pet" ( "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "name" TEXT NOT NULL, "userId" INTEGER, FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE SET NULL ON UPDATE CASCADE ); -- CreateIndex CREATE UNIQUE INDEX "Pet_userId_unique" ON "Pet"("userId");
true
81eb63f96be87d08d81fe24730f5f619256c1854
SQL
sydney-sisco/LightBnB
/seeds/01_seeds.sql
UTF-8
1,533
2.8125
3
[]
no_license
INSERT INTO users (name, email, password) VALUES ('example user', 'hello@example.com', '$2a$10$FB/BOAVhpuLvpOREQVmvmezD4ED/.JBIDRh70tGevYzYzQgFId2u.'), ('test user', 'hello@test.com', '$2a$10$FB/BOAVhpuLvpOREQVmvmezD4ED/.JBIDRh70tGevYzYzQgFId2u.'), ('sample user', 'hello@sample.com', '$2a$10$FB/BOAVhpuLvpOREQVmvmezD4ED/.JBIDRh70tGevYzYzQgFId2u.'); INSERT INTO properties (owner_id, title, description, thumbnail_photo_url, cover_photo_url, cost_per_night, parking_spaces, number_of_bathrooms, number_of_bedrooms, country, street, city, province, post_code, active) VALUES (1, 'My Basement', 'It is underground, you will love it', 'http://example.com/my_basement_small.bmp', 'http://example.com/my_basement.bmp', 50, 1, 1, 1, 'Canada', '123 Street st.', 'Town', 'BC', 'H0H0H0', true), (1, 'My Attic', 'It is up high, you might love it', 'http://example.com/my_attic_small.bmp', 'http://example.com/my_attic.bmp', 60, 1, 1, 1, 'Canada', '123 Street st.', 'Town', 'BC', 'H0H0H0', true), (2, 'Gravel Pit', 'Just a gravel pit.', 'http://example.com/gravel_small.bmp', 'http://example.com/gravel.bmp', 100, 3, 1, 0, 'Canada', '123 Gravel rd.', 'Quarry', 'BC', 'A0B1C2', true); INSERT INTO reservations (guest_id, property_id, start_date, end_date) VALUES (3, 1, '2020-11-03', '2020-11-10'), (3, 2, '2021-02-05', '2021-02-06'), (2, 3, '2021-01-01', '2021-02-01'); INSERT INTO property_reviews (guest_id, property_id, reservation_id, message, rating) VALUES (3, 1, 1, 'just right', 5), (3, 2, 2, 'too hot', 3), (2, 3, 3, 'yucky', 1);
true
6bf4eec5eb8f6dbcad9be5e67cce939db3e76372
SQL
ign-argentina/geoportal-desnormalizadas
/09.atributo_quitar_create_table.sql
UTF-8
1,186
2.96875
3
[]
no_license
-- Definición de la tabla atributo_quitar, se utiliza para filtar los atributos que no se van a publicar de la DB de IGN -- -- PostgreSQL database dump -- -- Dumped from database version 9.5.7 -- Dumped by pg_dump version 9.6.2 -- Started on 2019-05-02 13:23:36 SET search_path = desnormalizacion, pg_catalog; SET default_tablespace = ''; -- -- TOC entry 210 (class 1259 OID 979269) -- Name: atributo_quitar; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE atributo_quitar ( codigo character varying NOT NULL ); ALTER TABLE atributo_quitar OWNER TO postgres; ALTER TABLE ONLY atributo_quitar ADD CONSTRAINT pk_atributo_quitar PRIMARY KEY (codigo); -- -- TOC entry 4625 (class 0 OID 0) -- Dependencies: 210 -- Name: atributo_quitar; Type: ACL; Schema: public; Owner: postgres -- ALTER TABLE desnormalizacion.atributo_quitar OWNER to postgres; GRANT ALL ON TABLE desnormalizacion.atributo_quitar TO postgres; GRANT SELECT ON TABLE desnormalizacion.atributo_quitar TO readonly WITH GRANT OPTION; GRANT SELECT ON TABLE desnormalizacion.atributo_quitar TO readonly; -- Completed on 2019-05-02 13:23:36 -- -- PostgreSQL database dump complete --
true
e182c4dac09fabc855907816dafe78e90a79076d
SQL
xinyangwy/hfut-cs-assignments
/数据库系统/lab8.sql
UTF-8
918
4.125
4
[ "MIT" ]
permissive
/* CREATE VIEW V_SC_G(sno, sname, cno, cname, grade) AS SELECT student.sno, sname, course.cno, course.cname, grade FROM student, course, sc WHERE student.sno = sc.sno AND sc.cno = course.cno */ /* CREATE VIEW V_YEAR(sno, birthday) AS SELECT sno, YEAR(GETDATE()) - sage FROM student; */ /* CREATE VIEW V_AVG_S_G(sno, course_count, avg_grade) AS SELECT sno, COUNT(*), AVG(grade) FROM sc GROUP BY sno */ /* CREATE VIEW V_AVG_C_G(cno, attendance, avg_grade) AS SELECT cno, COUNT(*), AVG(grade) FROM sc GROUP BY cno */ /* SELECT student.sno, sname, avg_grade FROM student, V_AVG_S_G WHERE student.sno = V_AVG_S_G.sno AND avg_grade >= 90 SELECT sc.sno, cno, grade, avg_grade FROM sc, V_AVG_S_G WHERE sc.sno = V_AVG_S_G.sno AND grade > avg_grade SELECT student.sno, sname FROM student, V_YEAR WHERE student.sno = V_YEAR.sno AND birthday = 1996 */
true
7c08257ed945b87456016220e4a30b9cd4aeabef
SQL
ArvinRad/BootcampX
/4_queries/11_days_with_assignment_assist_number.sql
UTF-8
330
4.03125
4
[]
no_license
-- Get each day with the total number of assignments and the total duration of the assignmentsSELECT assignments.id as id, assignments.name as name, SELECT assignments.day as day, COUNT(assignments.id) as total_Number_of_assignment, SUM(assignments.duration) as duration FROM assignments GROUP BY assignments.day ORDER by day asc;
true
644dd6ac232e5bdcb8ec90e5df69c1b97458aff5
SQL
dmitrilacour/ClientProject
/DB SP/spSubmitTask.sql
UTF-8
416
2.875
3
[]
no_license
DELIMITER // CREATE PROCEDURE `spSubmitTask`(IN `intJobID` INT(11), IN `strTitle` VARCHAR(250), IN `strDescription` TEXT, IN `strDuration` TINYINT(4), IN `strPeople` TEXT, IN `strSupplies` TEXT) BEGIN INSERT INTO tblTask (`JobID`, `Title`, `Description`, `Duration`, `People`, `Supplies`) VALUES (intJobID, strTitle, strDescription, strDuration, strPeople, strSupplies); END // DELIMITER ;
true
5d0d3bf0d0f13a6176ee03435947f8501a9b97d0
SQL
AnuragDhn/Online-Restaurant-Booking
/hotel.sql
UTF-8
12,027
2.65625
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.1.4 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Jul 24, 2015 at 05:57 PM -- Server version: 5.6.15-log -- PHP Version: 5.5.8 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 utf8 */; -- -- Database: `hotel` -- -- -------------------------------------------------------- -- -- Table structure for table `menu1` -- CREATE TABLE IF NOT EXISTS `menu1` ( `id` int(3) NOT NULL, `code` varchar(15) NOT NULL, `item` varchar(100) NOT NULL, `category` varchar(100) NOT NULL, `price` decimal(6,2) NOT NULL, PRIMARY KEY (`item`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `menu1` -- INSERT INTO `menu1` (`id`, `code`, `item`, `category`, `price`) VALUES (1, 'bksb', 'Burger King Suicide Burger', 'SecretMenuItems', '150.00'), (1, 'cq', 'Chipotle Quesarito', 'SecretMenuItems', '120.40'), (1, 'dqfhc', 'Dairy Queen Frozen Hot Chocolate', 'SecretMenuItems', '190.00'), (1, 'ino', 'In N Out', 'SecretMenuItems', '160.00'), (1, 'jjpb&jsm', 'Jamba Juice PB And JS Moothie', 'SecretMenuItems', '190.00'), (1, 'kfcd&td', 'KFC Double and Triple Down', 'SecretMenuItems', '250.50'), (1, 'kfcp', 'KFC Poutine', 'SecretMenuItems', '280.00'), (1, 'lbs', 'Lavender Blue Sundae', 'SecretMenuItems', '190.00'), (1, 'McDPieMcFF', 'McDonalds Pie McFlurry Foods', 'SecretMenuItems', '220.50'), (1, 'sbf', 'Starbucks Biscotti Frappuccino', 'SecretMenuItems', '280.00'), (2, 'bwl', 'Banana Walnut Lassi', 'beverages', '120.00'), (2, 'cdm', 'Classic Dry Martini', 'beverages', '80.50'), (2, 'cm', 'Classic Mojito', 'beverages', '180.00'), (2, 'css', 'Classic Sangria Shatbhi', 'beverages', '160.00'), (2, 'e', 'Eternity', 'beverages', '130.80'), (2, 'g', 'Gimlet', 'beverages', '100.00'), (2, 'gn', 'Grape Nectar', 'beverages', '160.50'), (2, 'hc', 'Hot Chocolate ', 'beverages', '120.00'), (2, 'hfp', 'Hot Fruit Punch', 'beverages', '200.00'), (2, 'it', 'Iced Tea', 'beverages', '80.00'), (2, 'kd', 'Kesaria Doodh', 'beverages', '90.60'), (2, 'pc', 'Pina Colada', 'beverages', '140.00'), (2, 'tssvbk', 'The Sassy Spoon Very Berry Khatta', 'beverages', '220.00'), (2, 'vcc', 'Virgin Cucumber Cooler', 'beverages', '210.00'), (2, 'wm', 'Water Melonggranita', 'beverages', '190.50'), (3, 'aibcb', 'All In Beer Cheese Burger', 'snacks', '280.00'), (3, 'bwhd', 'Bacon Wrapped Hot Dog', 'snacks', '170.00'), (3, 'cp', 'Creamy Polenta', 'snacks', '180.00'), (3, 'hadb', 'Huevo Al Diablo', 'snacks', '200.00'), (3, 'ohp', 'Octopus Hush Puppies', 'snacks', '220.50'), (3, 'pc', 'Pub Cheese', 'snacks', '150.00'), (3, 'rc&pt', 'Red Chorizo & Potato Taco', 'snacks', '140.00'), (3, 'sfs&rc', 'Smoked Fish Spread & Rye Crackers', 'snacks', '250.00'), (3, 'sggw', 'Soy Garlic Ginger Wings', 'snacks', '190.00'), (3, 't', 'Tsukune', 'snacks', '180.60'), (3, 'vc', 'Veggie Chips', 'snacks', '120.80'), (3, 'wboc', 'Warm Bag Of Croutons', 'snacks', '190.80'), (4, 'bps', 'Baked Potato Soup', 'soups', '190.00'), (4, 'cawrs', 'Chicken and Wild Rice Soup', 'soups', '220.00'), (4, 'cvswh', 'Chicken Verde Stew with Hominy', 'soups', '180.00'), (4, 'cccs', 'Coconut Curry Chicken Soup', 'soups', '200.00'), (4, 'gm', 'Garden Minestrone', 'soups', '175.50'), (4, 'islal', 'Indian Spiced Lentils and Lamb', 'soups', '150.00'), (4, 'necc', 'New England Clam Chowder', 'soups', '190.00'), (4, 'nwbs', 'North Woods Bean Soup', 'soups', '160.70'), (4, 'rbsass', 'Roasted Butternut Squash and Shallot Soup', 'soups', '185.00'), (4, 'rcns', 'Roasted Chicken Noodle Soup', 'soups', '210.00'), (4, 'ssacc', 'Summer Squash and Corn Chowder', 'soups', '140.00'), (4, 'tbvc', 'Three Bean Vegetarian Chili', 'soups', '180.00'), (4, 'tbs', 'Tomato Basil Soup', 'soups', '145.00'), (4, 'tms', 'Tortilla Meatball Soup', 'soups', '240.00'), (4, 'tabc', 'Turkey and Bean Chili', 'soups', '205.50'), (5, 'afr', 'Asparagus Fried Rice', 'rice', '280.50'), (5, 'cs', 'Cajun Shrimp', 'rice', '290.00'), (5, 'cbrb', 'Chicken Broccoli Rice Bowl', 'rice', '320.00'), (5, 'cr', 'Chicken Rice', 'rice', '250.00'), (5, 'fr', 'Fried Rice', 'rice', '180.00'), (5, 'pscar', 'Paella Style Chicken And Rice', 'rice', '300.50'), (5, 'pc', 'Peanut Chicken', 'rice', '200.00'), (5, 'rbr', 'Red Beans Rice', 'rice', '190.00'), (5, 'sprs', 'Shrimp Pesto Rice Salad', 'rice', '215.00'), (6, 'cars', 'Chicken And Rice Soup', 'starter', '170.00'), (6, 'ccs', 'Chinese Chicken Salad', 'starter', '140.00'), (6, 'cl', 'Crab Louis', 'starter', '185.00'), (6, 'csafp', 'Crustless Spinach And Feta Pies', 'starter', '140.70'), (6, 'gs', 'Grain Salad', 'starter', '75.80'), (6, 'hcs', 'Healthy Chicken Satay', 'starter', '88.90'), (6, 'mmdgc', 'Mini Masala Dosa Green Chutney', 'starter', '70.80'), (6, 'pc', 'Panko Chicken', 'starter', '100.00'), (6, 'prppmr', 'Parmigiano Reggiano Pumpkin Porcini Mushroom Risotto', 'starter', '95.80'), (6, 'pp', 'Pizza Pockets', 'starter', '145.50'), (6, 'sap', 'Sag And Paneer', 'starter', '87.00'), (6, 'sccsrswcag', 'Slow Cooked Chinese Style Rice Soup With Chicken And Ginger', 'starter', '160.70'), (6, 'tg', 'Tenderstem Galette', 'starter', '88.00'), (6, 'wmawm', 'Wild Mushroom Arancini With Mozzarella', 'starter', '155.00'), (7, 'bsss', 'Black Sesame Shaved Snow', 'desserts', '215.00'), (7, 'c', 'Cannoli', 'desserts', '166.00'), (7, 'ccc', 'Chocolate Chunk Cookie', 'desserts', '95.00'), (7, 'cs', 'Cookie Shot', 'desserts', '90.00'), (7, 'hd', 'Halva Donut', 'desserts', '110.50'), (7, 'hm', 'Husk Meringue', 'desserts', '75.00'), (7, 'scps', 'Salted Caramel Pretzel Standard', 'desserts', '175.80'), (7, 'spss', 'Salty Pistachio Soft Serve', 'desserts', '195.50'), (8, '5tv', '5-Treasure Vegetables', 'mainCourseVeg', '275.00'), (8, '8tv', '8-Treasure Vegetables', 'mainCourseVeg', '320.00'), (8, 'anpirr', 'Aliv Nutri Paratha Iron Rich Recipe', 'mainCourseVeg', '220.00'), (8, 'ct', 'Celeriac Tart', 'mainCourseVeg', '255.00'), (8, 'cbcww', 'Chocolate Bean Chilli With Walnuts', 'mainCourseVeg', '300.00'), (8, 'cfamf', 'Courgette Feta And Mint Frittata', 'mainCourseVeg', '335.00'), (8, 'ccfwrsabawr', 'Crispy Cauliflower Florets With Romesco Sauce And Basmati And Wild Rice', 'mainCourseVeg', '288.00'), (8, 'gwspacl', 'Gnocchi With Spinach Pesto And Caramelised Leeks', 'mainCourseVeg', '245.50'), (8, 'matr', 'Mushroom And Taleggio Risotto', 'mainCourseVeg', '300.00'), (8, 'pomgsp', 'Pilaf Of Mixed Grains Sweet Potato And Fennel With Avocado Cream', 'mainCourseVeg', '295.00'), (8, 'qrwpas', 'Quinoa Risotto With Pumpkin And Spinach', 'mainCourseVeg', '280.80'), (8, 'sacbr', 'Shallot And Chicory Baked Rotolo With Hazelnuts', 'mainCourseVeg', '295.00'), (8, 'sbcbss', 'Spicy Butterbean Chickpea And Butternut Squash Stew', 'mainCourseVeg', '355.00'), (8, 'sapc', 'Spinach And Paneer Curry', 'mainCourseVeg', '300.00'), (9, 'cbm', 'Chicken Butter Masala', 'mainCourseNonVeg', '300.00'), (9, 'chm', 'Chicken Hariyali Masala', 'mainCourseNonVeg', '310.00'), (9, 'ckc', 'Chicken Kofta Curry', 'mainCourseNonVeg', '290.55'), (9, 'cmc', 'Chicken Mushroom Curry', 'mainCourseNonVeg', '350.00'), (9, 'cpc', 'Chicken Potato Curry', 'mainCourseNonVeg', '285.50'), (9, 'ctm', 'Chicken Tikka Masala', 'mainCourseNonVeg', '300.50'), (9, 'ccc', 'Coriander Chicken Curry', 'mainCourseNonVeg', '95.00'), (9, 'epc', 'Egg Poatato Curry', 'mainCourseNonVeg', '240.50'), (9, 'kc', 'Kheema Curry', 'mainCourseNonVeg', '290.00'), (9, 'mc', 'Meatball Curry', 'mainCourseNonVeg', '325.00'), (9, 'mm', 'Mutton Masala', 'mainCourseNonVeg', '360.00'), (9, 'pm', 'Prawn Masala', 'mainCourseNonVeg', '300.00'), (9, 'tmbc', 'Turkey Meat Balls Curry', 'mainCourseNonVeg', '365.00'); -- -------------------------------------------------------- -- -- Table structure for table `tablebooking` -- CREATE TABLE IF NOT EXISTS `tablebooking` ( `id` varchar(20) NOT NULL, `name` varchar(20) NOT NULL, `email` varchar(30) NOT NULL, `persons` int(2) NOT NULL, `date1` date NOT NULL, `time` varchar(15) NOT NULL, `status` varchar(20) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `tablebooking` -- INSERT INTO `tablebooking` (`id`, `name`, `email`, `persons`, `date1`, `time`, `status`) VALUES ('802838836', 'ANUP', 'anup@gmail.com', 7, '2015-06-10', '14:22', 'CONFIRM'), ('640484902', 'anurag', 'anuragyadavkool@gmail.com', 50, '2015-06-25', '17:05', 'CONFIRM'), ('1976800393', 'pratyush', 'p@gmail.com', 4, '2015-07-16', '15:30', 'CONFIRM'), ('379263928', 'RAVI', 'r@gmail.com', 5, '2015-07-16', '14:30', 'CONFIRM'), ('676083211', 'yuvraz', 'y@gmail.com', 5, '2015-07-16', '14:30', 'Pending'), ('1054929355', 'RS yadav', 'rs@gmail.com', 5, '2031-06-12', '12:30', 'CONFIRM'), ('1954892854', 'AGNISH', 'A@gmail.com', 5, '2015-07-10', '13:30', 'CONFIRM'), ('21729431', 'anurag', 'anuragyadavkool@gmail.com', 3, '2015-06-09', '15:03', 'CANCELLED'), ('1282840363', 'anurag', 'anuragyadavkool@gmail.com', 3, '2015-06-12', '15:03', ''), ('1337596065', 'R S yadav', 'anuragyadavkool@gmail.com', 1, '2015-06-03', '02:22', 'CONFIRM'), ('1263549797', 'anurag', 'anuragyadavkool@gmail.com', 3, '2015-06-04', '15:33', ''), ('1174726892', 'vikas', 'vvknid@gmail.com', 50, '2017-06-15', '14:02', ''), ('138511089', 'anurag', 'anuragyadavkool@gmail.com', 4, '2015-06-17', '16:04', ''), ('1858941227', 'anurag', 'anuragyadavkool@gmail.com', 4, '2015-06-03', '15:03', 'CANCELLED'), ('369725970', 'Sid', 'sid@gmail.com', 2, '2015-07-24', '14:22', 'Pending'), ('299270769', 'SHREYA', 'S@gmail.com', 7, '2023-06-15', '14:30', 'CONFIRM'), ('1118026920', 'AAyush', 'DNS@gmail.com', 7, '2015-06-11', '02:02', 'Pending'), ('1193902504', 'anurag', 'anuragyadavkool@gmail.com', 3, '2015-06-12', '15:33', ''), ('1889093527', 'anurag', 'anuragyadavkool@gmail.com', 3, '2015-06-03', '03:03', ''), ('11804189', 'RAMA Shankar yadav', 'rsy@gmail.com', 5, '2015-06-26', '15:03', ''), ('1379865401', 'asdas', 'asdasd@gmail.com', 5, '2015-06-18', '14:02', ''), ('936286637', 'anup', 'anup@gmail.com', 30, '2015-06-26', '14:02', 'CONFIRM'), ('410035938', 'Anurag Yadav', 'anuragyadavkiit@gmail.com', 5, '2015-07-04', '14:30', 'Pending'), ('632533595', 'Asha', 'asha@gmail.com', 20, '2015-06-25', '01:01', 'Pending'), ('260303864', 'sasa', 'anuragyadavkool@gmail.com', 2, '2015-06-10', '14:02', 'Pending'), ('121917073', 'anurag', 'anuragyadavkool@gmail.com', 2, '2015-06-17', '15:30', 'Pending'), ('546174322', 'anurag', 'anuragyadavkool@gmail.com', 2, '2015-06-28', '10:30', 'Pending'), ('1780719401', 'yuvraj', 'yv@gmail.com', 3, '2015-06-19', '01:01', 'CONFIRM'), ('428583419', 'anurag', 'anuragyadavkool@gmail.com', 3, '2015-06-10', '15:03', 'Pending'), ('906019886', 'Karan', 'karan@gmail.com', 5, '2015-06-19', '01:01', 'CONFIRM'), ('1668630748', 'Kriti', 'something@gmail.com', 5, '2015-06-18', '15:30', 'Pending'), ('1031304281', 'GEMINI', 'g@gmail.com', 5, '2015-07-22', '14:30', 'Pending'), ('279130306', 'Kashis', 'gemini@gmail.com', 5, '2015-07-16', '14:30', 'CONFIRM'), ('1782056481', 'Chandim', 'c@gmail.com', 6, '2015-07-17', '14:01', 'CONFIRM'), ('1743174819', 'xyz', 'x@mail.com', 5, '2015-07-17', '03:00', 'CONFIRM'), ('248745563', 'Jadu', 'j@gmail.com', 5, '2015-07-24', '14:30', 'CONFIRM'), ('493557611', 'INDER', 'i@gmail.com', 5, '2015-07-16', '15:30', 'CONFIRM'), ('418269063', 'Karan', 'k@gmail.com', 7, '2015-07-17', '15:00', 'CONFIRM'); -- -------------------------------------------------------- -- -- Table structure for table `visitorcomment` -- CREATE TABLE IF NOT EXISTS `visitorcomment` ( `id` int(20) NOT NULL, `name` varchar(20) NOT NULL, `comment` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `visitorcomment` -- INSERT INTO `visitorcomment` (`id`, `name`, `comment`) VALUES (1954892854, 'AGNISH', 'Will visit again....'), (369725970, 'Sid', 'its very good'), (248745563, 'Jadu', 'its good'), (906019886, 'Karan', 'surely i will visit again...'), (676083211, 'yuvraz', 'its vey bauuu....'), (279130306, 'Kashis', 'food is good\r\n'), (1782056481, 'Chandim', 'its very good'); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
616ae89daf8504c93a22d49b5961a51be7aaed22
SQL
thorwbm/lixiera_sql
/correcao/home/IMPORTAR_ATIVIDADE_COMPLEMENTAR.sql
UTF-8
5,286
3.71875
4
[]
no_license
/* --######################################################################################### -- ALINHAR AS TABELAS TIPO E MODALIDADE ------------------------------------------------------------------------------------------- insert into atividades_complementares_tipo (criado_em , atualizado_em, criado_por, atualizado_por, nome, atributos) select criado_em = getdate(), atualizado_em = getdate(), criado_por = 11717, atualizado_por = 11717, nome = ltrim(rtrim(edu.categoria)) collate database_default, atributos = null from atividade..VW_INTEGRACAO_EDUCAT_PARTICIPACAO edu left join atividades_complementares_tipo tip on (ltrim(rtrim(tip.nome)) collate database_default = ltrim(rtrim(edu.categoria)) collate database_default) where tip.id is null ------------------------------------------------------------------------------------------- insert into atividades_complementares_modalidade(criado_em , atualizado_em, criado_por, atualizado_por, nome, atributos) select criado_em = getdate(), atualizado_em = getdate(), criado_por = 11717, atualizado_por = 11717, nome = ltrim(rtrim(edu.funcao)) collate database_default, atributos = null from atividade..VW_INTEGRACAO_EDUCAT_PARTICIPACAO edu left join atividades_complementares_modalidade mdl on (ltrim(rtrim(mdl.nome)) collate database_default = ltrim(rtrim(edu.funcao)) collate database_default) where mdl.id is null ------------------------------------------------------------------------------------------- */ WITH CTE_EDUCAT AS ( select ALUNO_CPF = ALUNO_CPF COLLATE DATABASE_DEFAULT, DATA_REALIZACAO = CAST( DATA_REALIZACAO AS DATE), OBSERVACOES = ltrim(rtrim(OBSERVACOES)) COLLATE DATABASE_DEFAULT, FUNCAO_NOME = ltrim(rtrim(FUNCAO_NOME)) COLLATE DATABASE_DEFAULT, CATEGORIA_NOME = ltrim(rtrim(CATEGORIA_NOME)) COLLATE DATABASE_DEFAULT, CURSO_NOME = ltrim(rtrim(CURSO_NOME)) COLLATE DATABASE_DEFAULT from VW_ATIVIDADE_COMPLEMENTAR_ALUNO EDU WHERE EDU.ALUNO_CPF IN (select DISTINCT CPFALUNO COLLATE DATABASE_DEFAULT from atividade..VW_INTEGRACAO_EDUCAT_PARTICIPACAO) ) , cte_diferenca as ( SELECT DISTINCT * FROM CTE_EDUCAt EXCEPT SELECT DISTINCT CPFALUNO, CAST (DATACERTIFICADO AS DATE), ltrim(rtrim(OBSERVACAO)) COLLATE DATABASE_DEFAULT, ltrim(rtrim(FUNCAO)) COLLATE DATABASE_DEFAULT , ltrim(rtrim(CATEGORIA)) COLLATE DATABASE_DEFAULT , ltrim(rtrim(CURSO_NOME)) COLLATE DATABASE_DEFAULT FROM atividade..VW_INTEGRACAO_EDUCAT_PARTICIPACAO ) select * from cte_diferenca select distinct cpfaluno from atividade..VW_INTEGRACAO_EDUCAT_PARTICIPACAO -- #### DELETAR ATIVIDADES IMPORTADAS ######## select distinct ati.* -- delete ati from atividades_complementares_atividade ati join curriculos_aluno cra on (cra.id = ati.curriculo_aluno_id AND CRA.STATUS_ID IN (13,16,14,18)) JOIN curriculos_curriculo CRC ON (CRC.ID = CRA.curriculo_id) JOIN ACADEMICO_CURSO CUR ON (CUR.ID = CRC.curso_id) join academico_aluno alu on (alu.id = cra.aluno_id) join pessoas_pessoa pes on (pes.id = alu.pessoa_id) JOIN atividade..VW_INTEGRACAO_EDUCAT_PARTICIPACAO PAR ON (replace(replace(pes.cpf,'.',''),'-','') collate database_default = PAR.cpfaluno collate database_default ) SELECT * FROM atividades_complementares_atividade WHERE CRIADO_POR = 11717 -- ##### INSERIR ATIVIDADES COMPLEMENTARES ###### insert into atividades_complementares_atividade (criado_em, atualizado_em, criado_por, atualizado_por, atributos, carga_horaria, data_realizacao, observacoes, periodo, ano, modalidade_id, curriculo_aluno_id, tipo_id) select criado_em = getdate(), atualizado_em = getdate(), criado_por = 11717, atualizado_por = 11717, atributos = '{{"tipo":"integracao atividade"}}', carga_horaria = horcomputada, data_realizacao = datacertificado, observacoes = rtrim(ltrim(observacao)), periodo = CASE WHEN MONTH(datacertificado) <7 THEN 1 ELSE 2 END, ano = year(datacertificado), modalidade_id = mdl.id, curriculo_aluno_id = pes.curriculo_aluno_id, tipo_id = tip.id from atividade..VW_INTEGRACAO_EDUCAT_PARTICIPACAO edu join atividades_complementares_modalidade mdl on (mdl.nome collate database_default = edu.funcao collate database_default) join atividades_complementares_tipo tip on (tip.nome collate database_default = edu.categoria collate database_default) join vw_Curriculo_aluno_pessoa pes on (edu.CPFALUNO collate database_default = pes.aluno_cpf collate database_default and pes.curriculo_aluno_status_id in (13,16,14,18) and ltrim(rtrim(PES.CURSO_NOME)) COLLATE DATABASE_DEFAULT = ltrim(rtrim(EDU.CURSO_NOME)) COLLATE DATABASE_DEFAULT) WHERE EDU.EXPORTADO = 1 and edu.cpfaluno = '02084633648' order by 2,3
true
223cf00a100c523d55924bbea4ef0950770a5ea4
SQL
brodix78/cinema
/src/db/schema.sql
UTF-8
756
3.484375
3
[]
no_license
CREATE TABLE halls ( id INT, placeId SERIAL PRIMARY KEY, row VARCHAR(10), place VARCHAR(10) ); CREATE TABLE customers ( id SERIAL PRIMARY KEY, name TEXT, phone TEXT ); CREATE TABLE sessions ( id SERIAL PRIMARY KEY, hallId INT, time BIGINT, movie TEXT, price NUMERIC ); CREATE TABLE reservations ( sessionId INT NOT NULL, placeId INT NOT NULL, customerId INT NOT NULL, price NUMERIC, time BIGINT, CONSTRAINT sessions_id_fk FOREIGN KEY (sessionId) REFERENCES sessions (id), CONSTRAINT halls_placeId_fk FOREIGN KEY (placeId) REFERENCES halls (placeId), CONSTRAINT customers_id_fk FOREIGN KEY (customerId) REFERENCES customers (id), CONSTRAINT sessions_place_key PRIMARY KEY (sessionId, placeId) )
true
5b91faf1cdef970c9e1a287e285f35370830e10d
SQL
AlexanderKrustev/SoftUni
/CSharp Profession/DB Basics/06. Table Relations/10. Employee Departments.sql
UTF-8
199
3.953125
4
[]
no_license
SELECT TOP (5) e.EmployeeID, e.FirstName, e. Salary, d.Name FROM Employees AS e INNER JOIN Departments AS d ON e.DepartmentID=d.DepartmentID WHERE e.Salary>15000 ORDER BY e.DepartmentID
true
3ef6820a3bb9af2ce96b80e01d0f1b215a27802f
SQL
danstoyanov/CSharp-Databases
/HackerRank - MS SQL SERVER Problems/P38_AfricanCities.sql
UTF-8
125
3.609375
4
[ "MIT" ]
permissive
SELECT c.Name FROM City AS c JOIN Country AS ct ON ct.Code = c.CountryCode WHERE ct.Continent = 'Africa'
true
dc4a0f76867dc6a4a9d601baf9703be1ea55791a
SQL
lorenaelias/automatic-annotation
/sql/ExportAllwith1002.sql
UTF-8
2,664
3.390625
3
[]
no_license
select 'FT CDS complement(' || gene.pos_begin || '..' || gene.pos_end || ')', 'FT /locus_tag="' || gene.systematic_id ||'"', 'FT /gene="' || curated.name || '"', 'FT /product="' || curated.product || '"' , 'FT /similarity="Similar to '|| similarto.organismo ||', '|| similarto.produto || ' (' || similarto.tamanho_subject || ' aa), e-value: '|| similarto.evalue ||', '|| similarto.percentual ||' id in '|| similarto.tamanho_query ||' aa"' , 'FT /colour=' || decidecolor(gene.pseudogene, besthits.identity, besthits.size, gene.cds_size), 'FT /note="Local_subcelular(Surfg): ' || gene.local_subcelular || '"' , 'FT /blastp_file="blastp/Cp19.embl.seq.0' || substring(gene.systematic_id, '....$') || '.out";', getalldomain(gene.systematic_id),getsignal(gene.systematic_id),gettmh(gene.systematic_id) from gene LEFT OUTER JOIN (select distinct * from gene JOIN blasthits ON (gene.systematic_id = blasthits.query) where blasthits.identity > 60 and blasthits.size > (gene.cds_size*0.60) ) as besthits ON (gene.systematic_id = besthits.query) LEFT OUTER JOIN similarto ON (gene.systematic_id = similarto.query) LEFT OUTER JOIN curated USING (subject) where gene.orientation='-' UNION select 'FT CDS ' || gene.pos_begin || '..' || gene.pos_end, 'FT /locus_tag="' || gene.systematic_id ||'"', 'FT /gene="' || curated.name || '"', 'FT /product="' || curated.product || '"' , 'FT /similarity="Similar to '|| similarto.organismo ||', '|| similarto.produto || ' (' || similarto.tamanho_subject || ' aa), e-value: '|| similarto.evalue ||', '|| similarto.percentual ||' id in '|| similarto.tamanho_query ||' aa"' , 'FT /colour=' || decidecolor(gene.pseudogene, besthits.identity, besthits.size, gene.cds_size), 'FT /note="Local_subcelular(Surfg): ' || gene.local_subcelular || '"' , 'FT /blastp_file="blastp/Cp19.embl.seq.0' || substring(gene.systematic_id, '....$') || '.out";', getalldomain(gene.systematic_id),getsignal(gene.systematic_id),gettmh(gene.systematic_id) from gene LEFT OUTER JOIN (select distinct * from gene JOIN blasthits ON (gene.systematic_id = blasthits.query) where blasthits.identity > 60 and blasthits.size > (gene.cds_size*0.60) ) as besthits ON (gene.systematic_id = besthits.query) LEFT OUTER JOIN similarto ON (gene.systematic_id = similarto.query) LEFT OUTER JOIN curated USING (subject) where gene.orientation='+'
true
6a250443d58fe8efd65195df8a6457ae1fc5f9c0
SQL
giuliodse/EuroDS
/hive/exercises/3.sql
UTF-8
261
3.34375
3
[]
no_license
# For each company find the firts users who joined the SN # ====> Some companies had users register at the same time create table first_users_by_company as select company_id, user_id, min(unix_timestamp(created_at)) over (partition by company_id) from users ;
true
66edf0222fcca9df6a474eaebc93ff7bec86aca4
SQL
FelipeZuriel/blackwhite
/blackandwhite (1).sql
UTF-8
4,565
3.4375
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.8.5 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1:3306 -- Generation Time: 08-Nov-2019 às 13:23 -- Versão do servidor: 5.7.26 -- versão do PHP: 7.2.18 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 NAMES utf8mb4 */; -- -- Database: `blackandwhite` -- -- -------------------------------------------------------- -- -- Estrutura da tabela `enderecopedido` -- DROP TABLE IF EXISTS `enderecopedido`; CREATE TABLE IF NOT EXISTS `enderecopedido` ( `cep` int(11) NOT NULL, `rua` varchar(100) NOT NULL, `bairro` varchar(100) NOT NULL, `cidade` varchar(100) NOT NULL, `uf` varchar(4) NOT NULL, `numero` int(11) NOT NULL, PRIMARY KEY (`cep`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Estrutura da tabela `pedido` -- DROP TABLE IF EXISTS `pedido`; CREATE TABLE IF NOT EXISTS `pedido` ( `idPedido` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `dataPedido` datetime DEFAULT CURRENT_TIMESTAMP, `valorTotal` double UNSIGNED NOT NULL, `cpfUser` char(11) NOT NULL, `idProd` int(11) NOT NULL, `cep` int(11) NOT NULL, PRIMARY KEY (`idPedido`), UNIQUE KEY `fk_idProd` (`idProd`), UNIQUE KEY `fk_cep` (`cep`), KEY `FK_cpfUser` (`cpfUser`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Estrutura da tabela `produto` -- DROP TABLE IF EXISTS `produto`; CREATE TABLE IF NOT EXISTS `produto` ( `idProd` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `imagem` longblob NOT NULL, `descProd` varchar(160) NOT NULL, `qtdProd` int(11) NOT NULL, `infoAddProd` text, `precoUnit` double UNSIGNED NOT NULL, `idTipoProd` int(10) UNSIGNED NOT NULL, PRIMARY KEY (`idProd`), KEY `FK_idTipoProd` (`idTipoProd`) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; -- -------------------------------------------------------- -- -- Estrutura da tabela `tipo_produto` -- DROP TABLE IF EXISTS `tipo_produto`; CREATE TABLE IF NOT EXISTS `tipo_produto` ( `idTipoProd` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `descTipoProd` varchar(45) NOT NULL DEFAULT '', PRIMARY KEY (`idTipoProd`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; -- -- Extraindo dados da tabela `tipo_produto` -- INSERT INTO `tipo_produto` (`idTipoProd`, `descTipoProd`) VALUES (1, 'Livro'), (2, 'Geeks'); -- -------------------------------------------------------- -- -- Estrutura da tabela `tipo_usuario` -- DROP TABLE IF EXISTS `tipo_usuario`; CREATE TABLE IF NOT EXISTS `tipo_usuario` ( `idTipoUser` int(1) UNSIGNED NOT NULL AUTO_INCREMENT, `descTipoUser` varchar(7) NOT NULL, PRIMARY KEY (`idTipoUser`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; -- -- Extraindo dados da tabela `tipo_usuario` -- INSERT INTO `tipo_usuario` (`idTipoUser`, `descTipoUser`) VALUES (1, 'Admin'), (2, 'Normal'); -- -------------------------------------------------------- -- -- Estrutura da tabela `usuario` -- DROP TABLE IF EXISTS `usuario`; CREATE TABLE IF NOT EXISTS `usuario` ( `nomeUser` varchar(100) NOT NULL DEFAULT '', `cpfUser` varchar(11) NOT NULL, `emailUser` varchar(100) NOT NULL, `senhaUser` varchar(35) NOT NULL, `idTipoUser` int(1) UNSIGNED NOT NULL, PRIMARY KEY (`cpfUser`), KEY `FK_idTipoUser` (`idTipoUser`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- -- Extraindo dados da tabela `usuario` -- INSERT INTO `usuario` (`nomeUser`, `cpfUser`, `emailUser`, `senhaUser`, `idTipoUser`) VALUES ('Felpopo', '73234294', 'felps@gmail.com', '1', 1); -- -- Constraints for dumped tables -- -- -- Limitadores para a tabela `pedido` -- ALTER TABLE `pedido` ADD CONSTRAINT `FK_cpfUser` FOREIGN KEY (`cpfUser`) REFERENCES `usuario` (`cpfUser`); -- -- Limitadores para a tabela `produto` -- ALTER TABLE `produto` ADD CONSTRAINT `FK_idTipoProd` FOREIGN KEY (`idTipoProd`) REFERENCES `tipo_produto` (`idTipoProd`); -- -- Limitadores para a tabela `usuario` -- ALTER TABLE `usuario` ADD CONSTRAINT `FK_idTipoUser` FOREIGN KEY (`idTipoUser`) REFERENCES `tipo_usuario` (`idTipoUser`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
d7978bf847e356acfbff2a2983e92614bac435bb
SQL
phuonganh1003/leduongphuonganh
/BT đang làm.sql
UTF-8
7,406
4.1875
4
[]
no_license
-- select * from transactions select * from customer select * from Branch select * from account select * from Bank select count (cust_name) from customer select count(*) from customer --1. Có bao nhiêu khách hàng có ở Quảng Nam thuộc chi nhánh ngân hàng Vietcombank Đà Nẵng Select COUNT(*) as soluongKH from customer join Branch on customer. Br_id = Branch.BR_id where Cust_ad like N'QUẢNG NAM' AND BR_name like N'Vietcombank Đà Nẵng' --2. Hiển thị danh sách khách hàng thuộc chi nhánh Vũng Tàu và số dư trong tài khoản của họ. -- cột? hàng ? đk? select cust_name, ac_balance from customer join account on customer.Cust_id =account.cust_id join Branch on Branch.BR_id= customer.Br_id where BR_name like N'%Vũng Tàu%' --3. Trong quý 1 năm 2012, có bao nhiêu khách hàng thực hiện giao dịch rút tiền tại Ngân hàng Vietcombank? select count(distinct customer.Cust_id) as SoLuongKH from transactions join account on transactions.ac_no = account.Ac_no join customer on customer.cust_id = account.cust_id join Branch on customer.Br_id = Branch.BR_id join Bank on Bank.b_id = Branch.B_id where transactions.t_type = 0 and YEAR(t_date)= 2012 and MONTH(t_date) between 1 and 3 and b_name = N'Ngân hàng Công thương Việt Nam' --4. Thống kê số lượng giao dịch, tổng tiền giao dịch trong từng tháng của năm 2014 select count(t_id) as Soluonggiaodich, sum(t_amount) as tongtien, month(t_date) as thang from transactions where year(t_date)= 2014 group by month(t_date) --5. Thống kê tổng tiền khách hàng gửi của mỗi chi nhánh, sắp xếp theo thứ tự giảm dần của tổng tiền select Br_name, sum(t_amount) as TongTien from customer join branch on customer.Br_id = branch.br_id join account on customer.cust_id = account.cust_id join transactions on account.ac_no =transactions.ac_no where t_type = 1 group by Branch.Br_name, Branch.Br_ad order by sum( t_amount ) DESC --6. Chi nhánh Sài Gòn có bao nhiêu khách hàng không thực hiện bất kỳ giao dịch nào trong vòng 3 năm trở lại đây. -- Nếu có thể, hãy hiển thị tên và số điện thoại của các khách đó để phòng marketing xử lý. select Cust_name, cust_phone from Customer join Branch on customer.Br_id=Branch.BR_id join account on customer.Cust_id= account.cust_id where BR_name = N'Chi nhánh Sài Gòn' and Account. Ac_no not in (select ac_no from transactions where DATEDIFF(yyyy,t_date, getdate()) < 3) --7. Thống kê thông tin giao dịch theo mùa, nội dung thống kê gồm: số lượng giao dịch, -- lượng tiền giao dịch trung bình, tổng tiền giao dịch, lượng tiền giao dịch nhiều nhất, lượng tiền giao dịch ít nhất. Select count(t_id) as Soluonggiaodich, avg(t_amount) as Luongtiengiaodichtrungbinh, max(t_amount ) as luongtiengiaodichnhieunhat, min(t_amount) as Luongtiengiaodichitnhat from transactions group by DATEPART( QUARTER, T_date) --8. Tìm số tiền giao dịch nhiều nhất trong năm 2016 của chi nhánh Huế. Nếu có thể, hãy đưa ra tên của khách hàng thực hiện giao dịch đó. select cust_name, max(t_amount) as Sotiengiaodichnhieunhat from customer join Branch on customer.Br_id=branch.BR_id join account on customer.Cust_id=account.cust_id join transactions on account.Ac_no=transactions.ac_no where Br_name like N'%Huế%' and year(t_date)=2016 group by Cust_name --9. Tìm khách hàng có lượng tiền gửi nhiều nhất vào ngân hàng trong năm 2017 (nhằm mục đích tri ân khách hàng) select cust_name, sum (t_amount) as Tienguinhieunhat from customer join account on customer.Cust_id=account.cust_id join transactions on account.Ac_no=transactions.ac_no where t_type = 1 and YEAR(t_date)= 2017 and t_amount = (select top 1 sum(t_amount ) from customer join account on customer.cust_id = account.cust_id join transactions on account.Ac_no = transactions.ac_no where YEAR(t_date)=2017 group by customer.Cust_id order by sum(t_amount) DESC ) group by cust_name --10. Tìm những khách hàng có cùng chi nhánh với ông Phan Nguyên Anh select Cust_name from customer join Branch on customer.Br_id= Branch.BR_id where Branch.BR_id in ( select BR_id from customer where BR_name= N'Phan Nguyên' ) --11. Liệt kê những giao dịch thực hiện cùng giờ với giao dịch của ông Lê Nguyễn Hoàng Văn ngày 2016-12-02 select T_id, t_time, t_date, Cust_name from transactions join account on transactions.ac_no=account.Ac_no join customer on customer.Cust_id = account.cust_id where DATEPART(hour,t_time) in (select DATEPART(hour,t_time) from transactions join account on transactions.ac_no=account.Ac_no join customer on customer.Cust_id = account.cust_id where Cust_name = N'Lê Nguyễn Hoàng Văn' and t_date= '2016-12-02') --12. Hiển thị danh sách khách hàng ở cùng thành phố với Trần Văn Thiện Thanh select cust_name from customer where Cust_ad like (select cust_ad from customer where Cust_name = N'Trần Văn Thiện Thanh' ) group by Cust_name -- select cust_id, cust_name, Cust_ad from customer where REVERSE(LEFT(reverse(cust_ad), CHARINDEX(',', REVERSE(replace(cust_ad,'-', ',')))-1)) in (select REVERSE(left(reverse(cust_ad), CHARINDEX(',', REVERSE(replace(cust_ad,'-', ',')))-1)) from customer where cust_name= N'Trần Văn Thiện Thanh') --13. Tìm những giao dịch diễn ra cùng ngày với giao dịch có mã số 0000000217 --14. Tìm những giao dịch cùng loại với giao dịch có mã số 0000000387 --15. Những chi nhánh nào thực hiện nhiều giao dịch gửi tiền trong tháng 12/2015 hơn chi nhánh Đà Nẵng --16. Hãy liệt kê những tài khoảng trong vòng 6 tháng trở lại đây không phát sinh giao dịch --17. Ông Phạm Duy Khánh thuộc chi nhánh nào? Từ 01/2017 đến nay ông Khánh đã thực hiện bao nhiêu giao dịch gửi tiền vào ngân hàng với tổng số tiền là bao nhiêu. --18. Thống kê giao dịch theo từng năm, nội dung thống kê gồm: số lượng giao dịch, lượng tiền giao dịch trung bình --19. Thống kê số lượng giao dịch theo ngày và đêm trong năm 2017 ở chi nhánh Hà Nội, Sài Gòn --20. Hiển thị danh sách khách hàng chưa thực hiện giao dịch nào trong năm 2017? -- gộp theo nhóm dữ liệu- select danh sách cột 1, hàm gộp 1. hàm gộp 2 from(where) /group by:ds cột 2 select BR_ID ,COUNT(*) as SoluongKH from Customer group by BR_ID having COUNT(*) > 0 -- select BR_ID ,COUNT(*) as SoluongKH from Customer group by BR_ID having COUNT(*) > 2 -- select * from customer join Branch on customer.Br_id = Branch.Br_id --tìm ra những khách hàng có cùng chi nhánh với ông Hà công lực -- cột ? bảng? điều kiện? select Cust_name, br_id from customer where Br_id = (select customer.Br_id FROM customer JOIN Branch ON customer.Br_id= Branch.BR_id WHERE Cust_name = N'Hà Công Lực') -- select ac_no, ac_balance from account where ac_balance > all (select ac_balance from account join customer on account.cust_id=customer.Cust_id where Br_id = 'VB004')
true
5c683e4e15b6608f6abc28b9ecbfdf38775acaea
SQL
wwwjiahuan/message-board
/message.sql
UTF-8
2,249
3.203125
3
[]
no_license
-- phpMyAdmin SQL Dump -- version 4.1.14 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: 2016-09-12 16:15:58 -- 服务器版本: 5.6.17 -- PHP Version: 5.5.12 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 utf8 */; -- -- Database: `message` -- -- -------------------------------------------------------- -- -- 表的结构 `tp_message` -- CREATE TABLE IF NOT EXISTS `tp_message` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(60) NOT NULL DEFAULT '', `content` text NOT NULL, `filename` varchar(30) NOT NULL DEFAULT '', `time` int(11) NOT NULL, `uid` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=8 ; -- -- 转存表中的数据 `tp_message` -- INSERT INTO `tp_message` (`id`, `title`, `content`, `filename`, `time`, `uid`) VALUES (3, '题目2', '内容2', '57d6916bc6909.gif', 0, 0), (2, '题目1', '内容1', '57d68ba63599f.gif', 1473678246, 18), (4, '题目3', '内容3', '57d691b423ca1.gif', 1473679796, 18), (5, '题目4', '内容4', '57d6922e02878.gif', 1473679918, 18), (6, '只是王佳欢的留言', '2016.9.12', '57d6927860efb.gif', 1473679992, 19), (7, '题目5', '啊啊啊啊啊啊啊', '57d692979ce11.gif', 1473680023, 19); -- -------------------------------------------------------- -- -- 表的结构 `tp_user` -- CREATE TABLE IF NOT EXISTS `tp_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL DEFAULT '', `password` char(32) NOT NULL DEFAULT '', `sex` tinyint(4) NOT NULL DEFAULT '1', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=21 ; -- -- 转存表中的数据 `tp_user` -- INSERT INTO `tp_user` (`id`, `username`, `password`, `sex`) VALUES (20, 'wangjiahuan', '123', 0), (19, 'wjh123', '123', 0), (18, 'text123', '123', 1); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true
2fb0404a5b3222294f19e414118e427330ce6358
SQL
NareshViriyala/PHP
/mysql/ServerProcs/Restaurant/dbo.usp_get_PlacedOrderItems.sql
UTF-8
1,077
3.453125
3
[]
no_license
DROP PROCEDURE IF EXISTS dbo.usp_get_PlacedOrderItems; DELIMITER $$ CREATE PROCEDURE dbo.usp_get_PlacedOrderItems(input NVARCHAR(64)) BEGIN DECLARE _SubjectID INT; SELECT SubjectID INTO _SubjectID FROM dbo.tbl_mstr_EntitySubject WHERE SubjectGuid = input; SET SQL_SAFE_UPDATES=0; UPDATE dbo.tbl_rest_PlacedOrderMaster SET AckTime = NOW() , AckBit = 1 , CallWaiter = 1 WHERE SubjectID = _SubjectID; SET SQL_SAFE_UPDATES=1; SELECT rm.ID AS ItemID , rm.ItemGroup , rm.ItemName , rm.ItemPrice , os.Quantity , om.Person , om.DeviceID , om.ID AS MasterID , rm.OrderID , CASE rm.ItemType WHEN 1 THEN '1' ELSE '0' END AS ItemType FROM dbo.tbl_rest_PlacedOrderMaster om JOIN dbo.tbl_rest_PlacedOrderSlave os ON om.ID = os.MasterID JOIN dbo.tbl_mstr_RestaurantMenu rm ON os.TID = rm.ID WHERE om.SubjectID = _SubjectID ORDER BY om.DeviceID, rm.ID; END$$ DELIMITER ; #CALL dbo.usp_get_PlacedOrderItems('49F2F5AB-15AC-47C9-99B0-FC3CDBDF946B');
true
78d0cb2f8b3f05cced6428598b4d093c11af7a7e
SQL
a11smiles/ica-wbs
/Starter-artifacts/Resources/LAMP-lift-and-shift-starter/osticket-master/include/upgrader/streams/core/9ef33a06-8f99b8bf.patch.sql
UTF-8
878
2.921875
3
[ "MIT" ]
permissive
/** * @version v1.9.0 * @signature 8f99b8bf9bee63c8e4dc274ffbdda383 * @title Move organization support from UserAccount to User model. * */ ALTER TABLE `%TABLE_PREFIX%user` ADD `org_id` int(11) unsigned NOT NULL AFTER `id`, ADD `status` int(11) unsigned NOT NULL DEFAULT 0 AFTER `default_email_id`, ADD INDEX (`org_id`); ALTER TABLE `%TABLE_PREFIX%user_account` DROP `org_id`, ADD INDEX (`user_id`); ALTER TABLE `%TABLE_PREFIX%ticket` ADD INDEX (`user_id`); ALTER TABLE `%TABLE_PREFIX%draft` ADD `extra` text AFTER `body`; ALTER TABLE `%TABLE_PREFIX%organization` CHANGE `staff_id` `manager` varchar(16) NOT NULL DEFAULT '', CHANGE `domain` `domain` varchar(256) NOT NULL DEFAULT ''; UPDATE `%TABLE_PREFIX%config` SET `value` = '8f99b8bf9bee63c8e4dc274ffbdda383' WHERE `key` = 'schema_signature' AND `namespace` = 'core';
true
ce82bf6da92a47138575962813410c0fe3578c61
SQL
gfang200/additionalCodeExamples
/GameLtvModel/moves_adjust_ltv.sql
UTF-8
11,893
4
4
[]
no_license
--model_dataset_all-#-$- select case when publisher in ('organic','organic') then 'organic' else 'pac' end as source, 'all' as country, firstdate, stat_date-firstdate as date_diff, dense_rank() over (order by firstdate) as cohort, count(distinct user_uid) as user_cnt, sum(movenum_daily) as moves from etl_temp.adjust_ltv_GAMENAME where stat_date-firstdate>=0 and firstdate>='STARTDATE' and firstdate<='INSTALL_ENDDATE' and stat_date <= 'DAU_END' and publisher not in ('pmm emails', 'untrusted devices', 'xpromo', 'yahoo gemini', 'zynga') and platform = 'CLIENT' group by 1,2,3,4 order by 4,3,2,1; --model_dataset_publisher-#-$- select publisher, 'all' as country, firstdate, stat_date-firstdate as date_diff, dense_rank() over (order by firstdate) as cohort, count(distinct user_uid) as user_cnt, sum(movenum_daily) as moves from etl_temp.adjust_ltv_GAMENAME where stat_date-firstdate>=0 and firstdate>='STARTDATE' and firstdate<='INSTALL_ENDDATE' and stat_date <= 'DAU_END' and publisher in SOURCES and platform = 'CLIENT' group by 1,2,3,4 order by 4,3,2,1; --model_dataset_country-#-$- select case when publisher in ('organic','org') then 'organic' else 'pac' end as source, country, firstdate, stat_date-firstdate as date_diff, dense_rank() over (order by firstdate) as cohort, count(distinct user_uid) as user_cnt, sum(movenum_daily) as moves from etl_temp.adjust_ltv_GAMENAME where stat_date-firstdate>=0 and firstdate>='STARTDATE' and firstdate<='INSTALL_ENDDATE' and stat_date <= 'DAU_END' and country in COUNTRIES and platform = 'CLIENT' group by 1,2,3,4 order by 4,3,2,1; --model_dataset_publisher_country-#-$- select publisher, country, firstdate, stat_date-firstdate as date_diff, dense_rank() over (order by firstdate) as cohort, count(distinct user_uid) as user_cnt, sum(movenum_daily) as moves from etl_temp.adjust_ltv_GAMENAME where stat_date-firstdate>=0 and firstdate>='STARTDATE' and firstdate<='INSTALL_ENDDATE' and stat_date <= 'DAU_END' and publisher in SOURCES and country in COUNTRIES and platform = 'CLIENT' group by 1,2,3,4 order by 4,3,2,1; --dropIfExists_output_table-#-$- drop table if exists etl_temp.adjust_wwf_ltv_country_out_training cascade; --create_output_table_ifnotexists-#-$- create table if not exists etl_temp.adjust_wwf_ltv_country_out_training( game_id int, platform varchar(45), country varchar(45), publisher varchar(45), d0_move float, d1_move float, d2_move float, d3_move float, d4_move float, d5_move float, d6_move float, d7_ltv float, d180_ltv float, d365_ltv float, slope float, intercept float, refreshed datetime) order by game_id,platform,publisher segmented by game_id all nodes ksafe 1 ; --grant_permissions_output_table-#-$- grant select on etl_temp.adjust_wwf_ltv_country_out to analytics_user; --dropIfExists_ltv_table-#-$- drop table if exists etl_temp.adjust_ltv_GAMENAME cascade; --create_ltv_table-#-$- create table if not exists etl_temp.adjust_ltv_GAMENAME( user_uid varchar(40), game_id varchar(10), platform varchar(40), stat_date date, firstdate date, publisher varchar(65), country varchar(45), device_name varchar(65), movenum_daily float )order by user_uid segmented by hash(user_uid) all nodes ksafe 1; --grant_permissions-#-$- grant select on etl_temp.adjust_ltv_GAMENAME to public; --get_dau_all-#-$- insert /*+direct*/ into etl_temp.tmp_mud_u (metric, game_id, user_uid, date, date2, date3, metric2,metric3) select 'dau', game_id, hash(adid), created_at::date, created_at, client_device_ts,lower(os_name), case when lower(os_name) = 'android' then 'android' when lower(os_name) = 'ios' and lower(device_name) like '%ipad%' then 'ipad' when lower(os_name) = 'ios' and lower(device_name) like '%iphone%' then 'iphone' else 'others' end as platform from mkt.mkt_mob_adjust_events where game_id = GAME_ID and lower(event_name) = 'movesplayed' and move_type not in ('declined_invite','game_over','resigned') and move_type is not null and created_at::date between ('STARTDATE'::date-5) and ('INSTALL_ENDDATE'::date+70) and (lower(os_name) = 'android' or (lower(os_name) = 'ios' and (lower(device_name) like '%ipad%' or lower(device_name) like '%iphone%') )); --get_dau_one-#-$- insert /*+direct*/ into etl_temp.tmp_mud_u (metric, game_id, metric2, metric3,user_uid, date, date2, date3) select distinct 'dau_1', game_id, metric2, metric3,user_uid, date, date2, date3 from etl_temp.tmp_mud_u where metric = 'dau'; --get_dau_two-#-$- insert /*+direct*/ into etl_temp.tmp_mud_u (metric, game_id, metric2,metric3, user_uid, date, value) select 'dau_2', game_id, metric2, metric3,user_uid, date, count(date2) from etl_temp.tmp_mud_u where metric = 'dau_1' group by 1, 2, 3, 4, 5,6; --get_impression_cnt-#-$- INSERT /*+direct*/ into etl_temp.tmp_mud(metric,date,metric2,metric3,value2) select case when platform='Android' and ad_unit in ('Banner','Community Banner','Gameboard Banner','Native','Native Lobby') then'Android_Banner' when platform = 'Android' and ad_unit in ('Interstitial', 'Prestitial') then 'Android_Interstitial' when platform = 'iPad' and ad_unit in ('Banner','Community Banner','Gameboard Banner','Native','Native Lobby') then 'iPad_Banner' when platform = 'iPad' and ad_unit in ('Interstitial', 'Prestitial') then 'iPad_Interstitial' when platform = 'iPhone' and ad_unit in ('Banner','Community Banner','Gameboard Banner','Native','Native Lobby') then 'iPhone_Banner' when platform = 'iPhone' and ad_unit in ('Interstitial', 'Prestitial')then 'iPhone_Interstitial' else 'others' end, date, lower(platform), case when (ad_unit in ('Banner','Community Banner','Gameboard Banner','Native','Native Lobby') or ad_unit is null) then 'Banner' else 'Interstitial' end, sum(impressions) from report.r_adrev where game_id = GAME_ID and platform in ('Android','iPhone','iPad') and ad_unit in ('Banner','Community Banner','Gameboard Banner','Native','Native Lobby','Interstitial', 'Prestitial') and date between ('STARTDATE'::date) and ('STARTDATE'::date+30) group by 1,2,3,4; --get_total_num_move_day-#-$- insert /*+direct*/ into etl_temp.tmp_mud(metric, date, metric2, value) select 'num_moves', date, metric3, sum(value) from etl_temp.tmp_mud_u where date between ('STARTDATE'::date) and ('STARTDATE'::date+30) and metric = 'dau_2' group by 1, 2, 3 order by 1, 2, 3; --get_impression_per_move-#-$- INSERT /*+direct*/ into etl_temp.tmp_mud(metric, metric2, metric3, value_f) select 'imp_move', a.metric2, a.metric3, case when a.metric2 = 'android' then sum(a.value2)/(sum(b.value)*0.895) when a.metric2 = 'ipad' then sum(a.value2)/(sum(b.value)*0.508) when a.metric2 = 'iphone' then sum(a.value2)/(sum(b.value)*0.583) end as imp_per_move from etl_temp.tmp_mud a join etl_temp.tmp_mud b on a.date = b.date and a.metric2 = b.metric2 and b.metric = 'num_moves' where a.metric in ('Android_Banner', 'Android_Interstitial', 'iPad_Banner', 'iPad_Interstitial', 'iPhone_Banner', 'iPhone_Interstitial') and a.date between ('STARTDATE'::date) and ('STARTDATE'::date+30) group by 1,2,3; --merge_cpm_imp-#-$- insert /*+direct*/ into etl_temp.tmp_mud (metric,date,metric2,metric3,value_f,value_f2) select 'combine', a.date, a.platform, a.ads_type, a.cpm, b.value_f from (select b.date,b.platform,b.ads_type,b.cpm from etl_temp.ltv_cpm_new b inner join (select max(upload_date) as last_update_date from etl_temp.ltv_cpm_new ) c on b.upload_date= c.last_update_date) a left join etl_temp.tmp_mud b on b.metric= 'imp_move' and lower(a.platform) = b.metric2 and a.ads_type= b.metric3; --dropIfExists_rev_move_table-#-$- drop table if exists etl_temp.wwf_rev_per_move cascade; --create_daily_rev_move-#-$- create table if not exists etl_temp.wwf_rev_per_move( ads_date date, platform varchar(45), gross_rev_per_move float ) order by ads_date,platform; --grant_permissions_rev_move-#-$- grant select on etl_temp.wwf_rev_per_move to public; --get_insert_rev_move-#-$- insert /*+direct*/ into etl_temp.wwf_rev_per_move(ads_date,platform,gross_rev_per_move) select a.date::date, a.metric2, (a.value_f*a.value_f2+b.value_f*b.value_f2)*0.75/1000 as rev_per_move from etl_temp.tmp_mud a join etl_temp.tmp_mud b on a.date = b.date and a.metric2 = b.metric2 and b.metric3 = 'Banner' and b.metric2 <> 'Kindle' and b.metric = 'combine' where a.metric3 = 'Interstitial' and a.metric2 <> 'Kindle' and a.metric = 'combine'; --get_daily_rev_move-#-$- select ads_date, platform, gross_rev_per_move from etl_temp.wwf_rev_per_move where lower(platform)='CLIENT'; --get_install-#-$- insert /*+direct*/ into etl_temp.tmp_mud_u (metric, game_id, user_uid, date, metric2, metric3, metric4, metric5) select 'installs', game_id, hash(adid), min(installed_at::date), min(lower(network_name)), min(lower(country)), min(lower(device_name)), min(lower(os_name)) from mkt.mkt_mob_adjust_installs where game_id = GAME_ID group by 2,3 having min(installed_at::date)>=('STARTDATE'::date-20); --get_pushlier-#-$- select platform, publisher, country, count(user_uid) as install from etl_temp.adjust_ltv_GAMENAME where stat_date=firstdate group by 1,2,3; ; --get_ltv_data_date0-#-$- insert /*+ direct */ into etl_temp.adjust_ltv_GAMENAME(user_uid,game_id,platform,stat_date,firstdate,publisher,country,device_name,movenum_daily) select b.user_uid, b.game_id, case when b.metric5='ios' and lower(b.metric4) like '%iphone%' then 'iphone' when b.metric5='ios' and lower(b.metric4) like '%ipad%' then 'ipad' when b.metric5='android' then 'android' else 'others' end, case when a.date::date is null then b.date::date else a.date::date end, b.date::date, case when b.metric2 in ('facebook installs','off-facebook installs','facebook+installs','off-facebook+installs') then 'facebook' when b.metric2 in ('twitter installs','twitter publisher network') then 'twitter' else b.metric2 end, b.metric3, b.metric4, case when a.value is null then 0 else a.value end from etl_temp.tmp_mud_u b left join etl_temp.tmp_mud_u a on a.game_id=b.game_id and a.user_uid=b.user_uid and a.date::date = b.date::date and a.metric = 'dau_2' where b.metric='installs' and b.metric5 in ('ios','android'); --get_ltv_data_date_later-#-$- insert /*+ direct */ into etl_temp.adjust_ltv_GAMENAME(user_uid,game_id,platform,stat_date,firstdate,publisher,country,device_name,movenum_daily) select b.user_uid, b.game_id, case when b.metric5='ios' and lower(b.metric4) like '%iphone%' then 'iphone' when b.metric5='ios' and lower(b.metric4) like '%ipad%' then 'ipad' when b.metric5='android' then 'android' else 'others' end, case when a.date::date is null then b.date::date else a.date::date end, b.date::date, case when b.metric2 in ('facebook installs','off-facebook installs','facebook+installs','off-facebook+installs') then 'facebook' when b.metric2 in ('twitter installs','twitter publisher network') then 'twitter' else b.metric2 end, b.metric3, b.metric4, a.value from etl_temp.tmp_mud_u b inner join etl_temp.tmp_mud_u a on a.game_id=b.game_id and a.user_uid=b.user_uid where a.date::date > b.date::date and a.metric = 'dau_2' and b.metric='installs' and b.metric5 in ('ios','android');
true
bf577381a448e4d38fc51f542f897953a6cdc413
SQL
MikaelEpelbaum/094241-DB-project
/create_commands.sql
UTF-8
2,959
4.09375
4
[]
no_license
CREATE TABLE Character( cName VARCHAR(50) PRIMARY KEY, role VARCHAR(110), hairColor VARCHAR(40) ); CREATE TABLE Wizard( cName VARCHAR(50) PRIMARY KEY, wandID INTEGER CHECK(wandID > 0), FOREIGN KEY (cName) REFERENCES Character ON DELETE CASCADE ); CREATE TABLE Relationship( cName1 VARCHAR(50), cName2 VARCHAR(50), rType CHAR(4) CHECK (rType = 'Love' or rType = 'Hate'), PRIMARY KEY(cName1, cName2), FOREIGN KEY (cName1) REFERENCES Character(cName) ON DELETE CASCADE, FOREIGN KEY (cName2) REFERENCES Character(cName) ); CREATE TABLE Spell( magicWord VARCHAR(30) PRIMARY KEY, description VARCHAR(150), difLevel INTEGER, CHECK (difLevel >= 1 AND difLevel <= 5) ); CREATE TABLE MDate( dateVal DATETIME PRIMARY KEY ); CREATE TABLE Performed( cName VARCHAR(50), magicWord VARCHAR(30) NOT NULL, dateVal DATETIME, PRIMARY KEY (cName, dateVal), FOREIGN KEY (cName) REFERENCES Wizard ON DELETE CASCADE, FOREIGN KEY (dateVal) REFERENCES MDate ON DELETE CASCADE, FOREIGN KEY (magicWord) REFERENCES Spell ON DELETE CASCADE ); create view longestMagicWord as ( select magicWord as val from ( select top 1 magicWord, len(magicWord) as len from Spell where difLevel >=4 order by len desc ) as tbl); create view notOnlyStudent as ( select cName as val from Character where role like '%Student%' and CHARINDEX('|', role) > 0); create view mostBelovedNonWizard as ( select top 1 sums.name as val from (select R.cName2 as name, sum(case when R.rtype = 'Hate' then 1 else 0 end) as haters, sum(case when R.rtype = 'Love' then 1 else 0 end) as lovers from Relationship R group by R.cName2) as sums where haters >= 5 and sums.name not in (select cName from Wizard) order by lovers desc);
true
272fc606d9464b513460ef440e8c7c1ac51b29e1
SQL
pfmaher67/SoftLi
/src/test/resources/data.sql
UTF-8
1,122
2.859375
3
[]
no_license
insert into LicenseModel(id, name, licenseMetricId, softwareCategoryId) values ('MB-1', 'WAS ND', 0, 0) ,('MB-2', 'RHEL', 2, 1) ,('MB-3', 'MongoDB', 2, 0) ,('MB-4', 'Qualys', 2, 1) ,('MB-5', 'Kafka', 0, 0); insert into LicenseRight(id, appId, licenseModelId, qtyOwned, qtyReserved) values ('AB-1-MB-1', 'AB-1', 'MB-1', 32, 0) ,('AB-2-MB-1', 'AB-2', 'MB-1', 16, 0) ,('AB-2-MB-5', 'AB-2', 'MB-5', 64, 0) ,('AB-3-MB-3', 'AB-3', 'MB-3', 3, 0); insert into SoftwareRelease(id, name, version, licenseModelId) values ('RB-1', 'WAS ND exe', '8.1.1.13', 'MB-1') ,('RB-2', 'WAS ND exe2', '8.1.1.14', 'MB-1') ,('RB-3', 'RHEL 6', '6', 'MB-2') ,('RB-4', 'RHEL 7', '7', 'MB-2') ,('RB-5', 'Mongo', '3.6', 'MB-3') ,('RB-6', 'Qualys', 'X', 'MB-4') ,('RB-7', 'Kafka', 'Y', 'MB-5'); insert into Image(id, platform) values ('IB-1', 'AWS') ,('IB-2', 'AWS') ,('IB-3', 'AWS') ,('IB-4', 'AWS'); insert into manifest(imageId, swReleaseId) values ('IB-1', 'RB-1') ,('IB-1', 'RB-3') ,('IB-1', 'RB-6') ,('IB-2', 'RB-4') ,('IB-2', 'RB-6') ,('IB-2', 'RB-5') ,('IB-3', 'RB-2') ,('IB-3', 'RB-4') ,('IB-3', 'RB-6') ,('IB-3', 'RB-7');
true
dda4ddcbe398256280a206c884ee1523c8b73de7
SQL
AESJaverianaPica2020/jav-eas-providers-data-model
/mock_vuelos.sql
UTF-8
797
3.234375
3
[]
no_license
CREATE DATABASE VIVA_COLOMBIA_DB; USE VIVA_COLOMBIA_DB; CREATE TABLE VUELOS ( id INT PRIMARY KEY AUTO_INCREMENT, cabina VARCHAR(50) NOT NULL, ciudad_salida VARCHAR(250) NOT NULL, ciudad_llegada VARCHAR(250) NOT NULL, precio DECIMAL(12,2) NOT NULL, fecha_salida DATE NOT NULL, fecha_llegada DATE NOT NULL ); INSERT INTO VUELOS (cabina, ciudad_salida, ciudad_llegada, precio, fecha_salida, fecha_llegada) VALUES ('ECONOMICA', 'BOG', 'CTG', 160000, '2020-11-05', '2020-12-31'), ('MEDIANA', 'BOG', 'CTG', 360000, '2020-11-05', '2020-12-31'), ('PREMIUM', 'BOG', 'CTG', 860000, '2020-11-05', '2020-12-31'); CREATE TABLE RESERVAS_VUELOS ( vuelo_id INT NOT NULL, cantidad_pasajeros INT NOT NULL DEFAULT 1 ); INSERT INTO RESERVAS_VUELOS (vuelo_id, cantidad_pasajeros) VALUES (1, 2);
true
ffb66c16d8defb9af2235a5d49e41fad72894638
SQL
math209/yii
/db_books.sql
UTF-8
4,004
3.265625
3
[ "BSD-3-Clause" ]
permissive
-- phpMyAdmin SQL Dump -- version 4.7.4 -- https://www.phpmyadmin.net/ -- -- Хост: 127.0.0.1 -- Время создания: Фев 02 2018 г., 14:11 -- Версия сервера: 10.1.30-MariaDB -- Версия PHP: 7.2.1 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 NAMES utf8mb4 */; -- -- База данных: `db_books` -- -- -------------------------------------------------------- -- -- Структура таблицы `tbl_avtors` -- CREATE TABLE `tbl_avtors` ( `id` int(11) NOT NULL, `name` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `tbl_avtors` -- INSERT INTO `tbl_avtors` (`id`, `name`) VALUES (1, 'Толстой'), (2, 'Гоголь'), (3, 'Акунин'), (4, 'Пушкин'), (7, 'Достоевский'), (9, 'Лермонтов'); -- -------------------------------------------------------- -- -- Структура таблицы `tbl_books` -- CREATE TABLE `tbl_books` ( `id` int(11) NOT NULL, `avtor` int(11) NOT NULL, `name` varchar(255) NOT NULL, `year` int(4) NOT NULL, `genre` varchar(17) NOT NULL, `page` int(5) NOT NULL, `src` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `tbl_books` -- INSERT INTO `tbl_books` (`id`, `avtor`, `name`, `year`, `genre`, `page`, `src`) VALUES (11, 3, 'Азазель', 1998, 'детектив', 310, 'азазель.jpg'), (4, 2, 'мёртвые души', 1842, 'детектив', 500, 'мёртвые души.jpg'), (7, 4, 'Сказка о рыбаке и рыбке', 1835, 'сказка', 300, 'Сказка о рыбаке и рыбке.gif'), (12, 3, 'Турецкий гамбит', 1998, 'детектив', 222, 'турецкий гамбит.jpg'), (9, 3, 'Нефритовые чётка', 2006, 'детектив', 704, 'нефритовые чётка.jpg'), (10, 3, 'Особые поручения', 1980, 'детектив', 523, 'особые поручения.jpg'), (13, 1, 'Война и мир', 1973, 'роман', 1290, 'Война и мир.gif'), (14, 9, 'Демон', 1842, 'поэма', 100, 'Демон.jpg'), (15, 7, 'Идеот', 1868, 'роман', 305, 'Идеот.jpg'); -- -------------------------------------------------------- -- -- Структура таблицы `tbl_users` -- CREATE TABLE `tbl_users` ( `id` int(11) NOT NULL, `name` varchar(17) NOT NULL, `pass` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -- -- Дамп данных таблицы `tbl_users` -- INSERT INTO `tbl_users` (`id`, `name`, `pass`) VALUES (1, 'qwer', '4321'); -- -- Индексы сохранённых таблиц -- -- -- Индексы таблицы `tbl_avtors` -- ALTER TABLE `tbl_avtors` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `tbl_books` -- ALTER TABLE `tbl_books` ADD PRIMARY KEY (`id`); -- -- Индексы таблицы `tbl_users` -- ALTER TABLE `tbl_users` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT для сохранённых таблиц -- -- -- AUTO_INCREMENT для таблицы `tbl_avtors` -- ALTER TABLE `tbl_avtors` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10; -- -- AUTO_INCREMENT для таблицы `tbl_books` -- ALTER TABLE `tbl_books` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16; -- -- AUTO_INCREMENT для таблицы `tbl_users` -- ALTER TABLE `tbl_users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
true