text stringlengths 6 9.38M |
|---|
desc store;
--1번 학동점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(1,'학동점','00:00~23:59','02-515-1014','서울 강남구 학동로 171',3000,'15분~20분',null,null);
--2번 수서점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(2,'수서점','08:00~23:00','02-445-1636','서울 강남구 밤고개로 1길 10 B1',2000,'10분~20분',null,null);
--3번 봉은사점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(3,'봉은사점','08:00~22:00','02-545-5729','서울시 강남구 봉은사로 627',2000,'10분~20분',null,null);
--4번 강남역 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(4,'강남역','08:00~22:00','02-557-4727','서울 강남구 강남대로96길 12',3000,'15분~20분',null,null);
--5번 선정릉점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(5,'선정릉점','08:00~23:00','02-555-9389','서울 강남구 봉은사로 328',2000,'10분~20분',null,null);
--6번 강남구청점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(6,'강남구청점','08:00~22:00','02-545-0806','서울 강남구 선릉로 653',2000,'10분~20분',null,null);
--7번 압구정점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(7,'압구정점','08:00~22:00','02-548-1014','서울 강남구 압구정로 28길 13',3000,'15분~20분',null,null);
--8번 언주점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(8,'언주점','08:00~23:00','02-557-8805','서울 강남구 봉은사로 206대명빌딩',2000,'10분~20분',null,null);
--9번 삼성점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(9,'삼성점','08:00~23:00','02-2051-2008','서울 강남구 삼성로 520',2000,'10분~20분',null,null);
--10번 신사점 정보입력
insert into STORE(store_no,store_name,store_businessTime,store_phone,store_address,store_deliveryPrice,jumun_estimatedTime,store_rating,jumun_no)
values(10,'신사점','08:00~22:00','02-546-2007','서울 강남구 도산대로 124 대영빌딩',3000,'15분~20분',null,null);
|
# Report total payments for Atelier graphique.
SELECT SUM(amount) FROM Payments AS p
JOIN Customers AS c ON p.customerNumber=c.customerNumber
WHERE c.customerNumber = (
SELECT customerNumber FROM Customers WHERE customerName = 'Atelier graphique'
) |
SELECT DISTINCT ON
(i.id,priority) i.id,u.id AS user_id, user_name, user_phone, user_avatar,
item_category, item_title, item_price, item_description,
item_location, item_lat, item_lng, im.image_url, priority
FROM users u INNER JOIN
items i
ON u.id = i.user_id INNER JOIN
images im
ON im.post_id = i.id
ORDER BY priority DESC; |
DELETE FROM hibernate_sequence;
INSERT INTO hibernate_sequence(next_val) VALUE (10);
DELETE FROM message;
INSERT INTO message(id, text, tag, user_id) VALUES
(1, 'first', 'my-tag', 1),
(2, 'second', 'more', 1),
(3, 'third', 'my-tag', 1),
(4, 'fourth', 'another', 1);
# TODO reset indexes |
if (select count(*) from Tournaments) = 0
BEGIN
insert into Tournaments (Name) values ('Tournament 1'), ('Tournament 2')
END |
USE orders;
SELECT * FROM order_one;
-- Второе задание
SELECT MAX(o_date) FROM order_one;
SELECT MIN(o_date) FROM order_one;
-- Наблюдаемый периуд с 2001 по 2031
-- Третье задание
SELECT COUNT(DISTINCT(user_id)) AS users FROM order_one; -- количество пользлвателей 28,938
SELECT COUNT(*) FROM order_one; -- количество строк 37,714
SELECT COUNT(DISTINCT(order_id)) AS users FROM order_one; -- количество заказов 37,714
-- Четвертое задание
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2001';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2002';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2003';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2004';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2005';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2006';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2007';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2008';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2009';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2010';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2011';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2012';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2013';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2014';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2015';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2016';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2017';
SELECT AVG(price) FROM order_one WHERE YEAR(o_date) = '2018'; |
CREATE TABLE `user_op` (
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'id,自增长',
`userId` varchar(36) CHARACTER SET utf8mb4 NOT NULL COMMENT 'userId',
`op` varchar(20) comment '行为',
`resourceId` varchar(36) CHARACTER SET utf8mb4 COMMENT '资源id',
`note` text COMMENT '备注',
`createTime` timestamp NOT NULL default CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`)
)ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = '用户行为表'; |
USE burgers_db;
INSERT INTO eats (bName, eaten) VALUES ("Super Chicken Bacon", false);
INSERT INTO eats (bName, eaten) VALUES ("Veggie", true);
INSERT INTO eats (bName, eaten) VALUES ("Regular no toppings", false);
|
# --- !Ups
alter table section alter num type varchar(8);
alter table entry alter num type varchar(8);
# --- !Downs
alter table section alter num type int;
alter table entry alter num type int;
|
-- Produce a monotonically increasing numbered list of members, ordered by their date of joining. Remember that member IDs are not guaranteed to be sequential.
select count(*) over(order by joindate) as row_number,
firstname,
surname
from cd.members
order by joindate;
select row_number() over(order by joindate), firstname, surname
from cd.members
order by joindate;
-- In this query, we don't define a partition, meaning that the partition is the entire dataset. Since we define an order for the window function, for any given row the window is: start of the dataset -> current row. |
--修改日期:2012-11-09
--修改人:卢燕南
--修改内容:添加字段
--修改原因:中远——ZY-ZH-06
--添加字段
alter table bt_dictionary add stat number(10);
--添加字段注释
comment on column BT_DICTIONARY.stat is '状态';
commit;
|
-- Here we are creating a table called users. Note that we have created a priamry key user id and set it to auto_increment.
CREATE TABLE users (
userID MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
firstName VARCHAR(15) NOT NULL,
lastName VARCHAR(30) NOT NULL,
email VARCHAR(40) NOT NULL,
password CHAR(40) NOT NULL,
regDate DATE NOT NULL,
PRIMARY KEY (userID)
); |
/* Part 1 */
create database mydb;
use mydb;
create table BUS(BusNo int primary key,
Origin varchar(100),
Dest varchar(100),
Rate int,
Km int
);
|
-- Banco de Dados SCHEMA
-- ________________
create database Eventos_Cientificos;
use Eventos_Cientificos;
-- Tabelas
-- _____________
create table APRESENTA (
cpf bigint not null,
codigo_atividade int not null,
constraint ID_APRESENTA_ID primary key (codigo_atividade, cpf));
create table APRESENTADO_EM (
DOI varchar(255) not null,
codigo_atividade int not null,
constraint ID_APRESENTADO_EM_ID primary key (DOI, codigo_atividade));
create table Artigo (
titulo varchar(255) not null,
DOI varchar(255) not null,
revista_publicacao varchar(255) not null,
id_comite int not null,
constraint ID_Artigo_ID primary key (DOI));
create table Atividade (
nome varchar(255) not null,
codigo_atividade int not null auto_increment,
id_evento int not null,
tipo_atividade varchar(100) not null,
constraint ID_Atividade_ID primary key (codigo_atividade));
create table Atividade_social (
codigo_atividade int not null,
tipo varchar(255) not null,
valor_convite float not null,
constraint ID_Ativi_Ativi_ID primary key (codigo_atividade));
create table Autor_Artigo (
cpf bigint not null,
minicurriculo varchar(255) not null,
constraint ID_Autor_Parti_ID primary key (cpf));
create table Avaliador (
cpf bigint not null,
constraint ID_Avali_Parti_ID primary key (cpf));
create table Canal_informativo (
Id_canal int not null auto_increment,
Nome varchar(255) not null,
URL varchar(255) not null,
Nome_caravana varchar(255) not null,
constraint ID_Canal_informativo_ID primary key (Id_canal));
create table Caravana (
Nome_caravana varchar(255) not null,
Data_saida date not null,
Data_chegada date not null,
Id_local int not null,
constraint ID_Caravana_ID primary key (Nome_caravana));
create table Certificado (
titulo varchar(255) not null,
numero_certificado int not null auto_increment,
cpf bigint not null,
descricao varchar(255) not null,
carga_horaria int not null,
data_emissao date not null,
cnpj bigint not null,
constraint ID_Certificado_ID primary key (numero_certificado),
constraint SID_Certi_Parti_ID unique (cpf));
create table Comite_Programa (
id_comite int not null auto_increment,
constraint ID_Comite_Programa_ID primary key (id_comite));
create table COMPOE (
id_comite int not null,
cpf bigint not null,
constraint ID_COMPOE_ID primary key (id_comite, cpf));
create table Concurso (
codigo_atividade int not null,
tema varchar(255) not null,
constraint ID_Concu_Ativi_ID primary key (codigo_atividade));
create table CONDUZ (
codigo_atividade int not null,
cpf bigint not null,
constraint ID_CONDUZ_ID primary key (codigo_atividade, cpf));
create table CONTRATA (
cpf bigint not null,
data_inicio date not null,
data_fim date not null,
cnpj bigint not null,
constraint ID_CONTR_Organ_ID primary key (cpf));
create table Contrato (
id_contrato int not null auto_increment,
representante_evento varchar(255) not null,
representante_patrocinadora varchar(255) not null,
taxa_patrocinio float not null,
plano_patrocinio varchar(255) not null,
data_inicio date not null,
data_fim date not null,
cnpj bigint not null,
C_O_cnpj bigint not null,
constraint ID_Contrato_ID primary key (id_contrato));
create table DIVULGA (
Id_canal int not null,
cpf bigint not null,
constraint ID_DIVULGA_ID primary key (cpf, Id_canal));
create table Entidade (
cnpj bigint not null,
end_logradouro varchar(255) not null,
end_cidade varchar(255) not null,
end_estado varchar(255) not null,
end_cep varchar(255) not null,
end_numero varchar(255) not null,
nome_entidade varchar(255) not null,
email varchar(255) not null,
senha varchar(255) not null,
Promotora boolean,
Patrocinadora boolean,
Organizadora boolean,
constraint ID_Entidade_ID primary key (cnpj));
create table Equipamento (
nome varchar(255) not null,
codigo_equipamento int not null auto_increment,
valor float not null,
codigo_local int not null,
constraint ID_Equipamento_ID primary key (codigo_equipamento));
create table Evento (
tema varchar(255) not null,
id_evento int not null auto_increment,
edicao tinyint not null,
nome varchar(255) not null,
data_inicio date not null,
data_fim date not null,
cnpj bigint not null,
PRO_cnpj bigint not null,
constraint ID_Evento_ID primary key (id_evento));
create table FAZ_LOCACAO (
id_contrato int not null,
id_evento int not null,
data_inicio date not null,
data_fim date not null,
valor float not null,
id_local int not null,
constraint ID_FAZ_LOCACAO_ID primary key (id_contrato),
constraint SID_FAZ_L_Event_ID unique (id_evento));
create table INGRESSO (
numero_ingresso int not null auto_increment,
numero_lote tinyint not null,
data date not null,
desconto float not null,
forma_pagamento varchar(255) not null,
cpf bigint not null,
id_evento int not null,
constraint ID_INGRESSO_ID primary key (numero_ingresso));
create table INSCREVE (
codigo_atividade int not null,
cpf bigint not null,
constraint ID_INSCREVE_ID primary key (codigo_atividade, cpf));
create table Instrutor (
cpf bigint not null,
constraint ID_Instr_Parti_ID primary key (cpf));
create table JULGA (
codigo_atividade int not null,
cpf bigint not null,
constraint ID_JULGA_ID primary key (codigo_atividade, cpf));
create table Local (
nome varchar(255) not null,
id_local int not null auto_increment,
valor_locacao float not null,
Local_online boolean,
Local_presencial boolean,
constraint ID_Local_ID primary key (id_local));
create table Local_atividade (
nome varchar(255) not null,
capacidade int not null,
codigo_local int not null auto_increment,
id_local int not null,
constraint ID_Local_atividade_ID primary key (codigo_local));
create table Local_online (
id_local int not null,
url varchar(255) not null,
constraint ID_Local_Local_1_ID primary key (id_local));
create table Local_origem (
Id_local int not null auto_increment,
Logradouro varchar(255) not null,
Cidade varchar(255) not null,
Estado varchar(255) not null,
CEP int not null,
Numero varchar(255) not null,
constraint ID_Local_origem_ID primary key (Id_local));
create table Local_presencial (
id_local int not null,
end_logradouro varchar(255) not null,
end_cidade varchar(255) not null,
end_estado varchar(255) not null,
end_cep varchar(255) not null,
end_numero varchar(255) not null,
capacidade int not null,
area float not null,
constraint ID_Local_Local_ID primary key (id_local));
create table Lote (
numero_lote tinyint not null,
valor float not null,
constraint ID_Lote_ID primary key (numero_lote));
create table MINISTRA (
codigo_atividade int not null,
cpf bigint not null,
constraint ID_MINISTRA_ID primary key (codigo_atividade, cpf));
create table Ministrante_tutoria (
cpf bigint not null,
afiliacao varchar(255) not null,
minicurriculo varchar(255) not null,
constraint ID_Minis_Parti_ID primary key (cpf));
create table Mobilizador_caravana (
CPF bigint not null,
Nome varchar(255) not null,
Telefone int not null,
CEP int not null,
Nome_caravana varchar(255) not null,
cnpj bigint not null,
COO_CPF bigint not null,
Id_canal int not null,
constraint ID_Mobilizador_caravana_ID primary key (CPF));
create table Movimentacao_Financeira (
tipo varchar(255) not null,
descricao varchar(500) not null,
codigo_movimentacao int not null auto_increment,
valor_a_pagar float not null,
quantidade int not null,
id_evento int not null,
constraint ID_Movimentacao_Financeira_ID primary key (codigo_movimentacao));
create table Nota_Fiscal (
numero_nota int not null auto_increment,
codigo_movimentacao int not null,
cnpj_emissor bigint not null,
nome_razao_social varchar(255) not null,
inscricao_municipal varchar(255) not null,
codigo_verificacao varchar(255) not null,
valor float not null,
data_emissao date not null,
constraint ID_Nota_Fiscal_ID primary key (numero_nota),
constraint SID_Nota__Movim_ID unique (codigo_movimentacao));
create table ORGANIZA (
codigo_atividade int not null,
cpf bigint not null,
constraint ID_ORGANIZA_ID primary key (codigo_atividade, cpf));
create table Organizador (
cpf bigint not null,
remuneracao float not null,
carga_horaria float not null,
constraint ID_Organ_Parti_ID primary key (cpf));
create table Organizadora (
cnpj bigint not null,
constraint ID_Organ_Entid_ID primary key (cnpj));
create table Ouvinte (
cpf bigint not null,
constraint ID_Ouvin_Parti_ID primary key (cpf));
create table Palestra (
codigo_atividade int not null,
descricao varchar(500) not null,
publico_alvo varchar(255) not null,
constraint ID_Pales_Ativi_ID primary key (codigo_atividade));
create table Palestrante (
cpf bigint not null,
filiacao varchar(255) not null,
minicurriculo varchar(255) not null,
constraint ID_Pales_Parti_ID primary key (cpf));
create table Participante (
nome varchar(255) not null,
cpf bigint not null,
cep int not null,
senha varchar(255) not null,
e_mail varchar(255) not null,
telefone int not null,
Staff boolean,
Palestrante boolean,
Ouvinte boolean,
Organizador boolean,
Ministrante_tutoria boolean,
Instrutor boolean,
Avaliador boolean,
Autor_Artigo boolean,
constraint ID_Participante_ID primary key (cpf));
create table Participante_caravana (
cpf bigint not null,
Valor_passagem float not null,
Nome_caravana varchar(255) not null,
constraint FKPar_Par_ID primary key (cpf));
create table participantes_concurso (
codigo_atividade int not null,
nome_participante varchar(255) not null,
constraint ID_participantes_concurso_ID primary key (codigo_atividade, nome_participante));
create table participantes_reuniao (
codigo_atividade int not null,
nome_participante varchar(255) not null,
constraint ID_participantes_reuniao_ID primary key (codigo_atividade, nome_participante));
create table PATROCINA (
cnpj bigint not null,
id_evento int not null,
constraint ID_PATROCINA_ID primary key (id_evento, cnpj));
create table Patrocinadora (
cnpj bigint not null,
constraint ID_Patro_Entid_ID primary key (cnpj));
create table premiacao_concurso (
codigo_atividade int not null,
premio varchar(255) not null,
colocacao int not null,
constraint ID_premiacao_concurso_ID primary key (codigo_atividade, premio, colocacao));
create table Promotora (
cnpj bigint not null,
constraint ID_Promo_Entid_ID primary key (cnpj));
create table PUBLICA (
cpf bigint not null,
DOI varchar(255) not null,
constraint ID_PUBLICA_ID primary key (DOI, cpf));
create table Rede_Social (
nome varchar(255) not null,
url varchar(255) not null,
usuario varchar(255) not null,
id_evento int not null,
cnpj bigint not null,
constraint ID_Rede_Social_ID primary key (url));
create table regras_concurso (
codigo_atividade int not null,
regra varchar(255) not null,
constraint ID_regras_concurso_ID primary key (codigo_atividade, regra));
create table REPRESENTA (
cnpj bigint not null,
cpf_representante bigint not null,
constraint ID_REPRESENTA_ID primary key (cpf_representante, cnpj));
create table Representante (
cpf_representante bigint not null,
nome varchar(255) not null,
email varchar(255) not null,
telefone int not null,
constraint ID_Representante_ID primary key (cpf_representante));
create table Reuniao (
codigo_atividade int not null,
objetivo varchar(500) not null,
constraint ID_Reuni_Ativi_ID primary key (codigo_atividade));
create table Sessao (
data_inicio date not null,
data_fim date not null,
codigo_atividade int not null,
codigo_local int not null,
constraint ID_Sessao primary key (codigo_atividade),
constraint SID_Sessao_ID unique (data_inicio));
create table Sessao_artigo (
codigo_atividade int not null,
tipo varchar(255) not null,
numero_sessoes int not null,
responsavel varchar(255) not null,
constraint ID_Sessa_Ativi_ID primary key (codigo_atividade));
create table Staff (
cpf bigint not null,
constraint ID_Staff_Parti_ID primary key (cpf));
create table tipo_participante (
numero_certificado int not null,
tipo_participante char(255) not null,
constraint ID_tipo_participante_ID primary key (numero_certificado, tipo_participante));
create table Tutoria (
codigo_atividade int not null,
valor_inscricao float not null,
tema varchar(255) not null,
publico_alvo varchar(255) not null,
constraint ID_Tutor_Ativi_ID primary key (codigo_atividade));
create table UTILIZA (
codigo_atividade int not null,
codigo_equipamento int not null,
quantidade int not null,
constraint ID_UTILIZA_ID primary key (codigo_equipamento, codigo_atividade));
create table Veiculo (
Codigo_veiculo int not null auto_increment,
Tipo varchar(255) not null,
Valor_passagem float not null,
Nome_companhia varchar(255) not null,
Nome_caravana varchar(255) not null,
constraint ID_Veiculo_ID primary key (Codigo_veiculo));
create table Workshop (
codigo_atividade int not null,
valor_inscricao float not null,
tema varchar(255) not null,
publico_alvo varchar(255) not null,
constraint ID_Works_Ativi_ID primary key (codigo_atividade));
-- Constraints Section
-- ___________________
alter table APRESENTA add constraint EQU_APRES_Pales_1
foreign key (codigo_atividade)
references Palestra (codigo_atividade);
alter table APRESENTA add constraint EQU_APRES_Pales_FK
foreign key (cpf)
references Palestrante (cpf);
alter table APRESENTADO_EM add constraint EQU_APRES_Sessa_FK
foreign key (codigo_atividade)
references Sessao_artigo (codigo_atividade);
alter table APRESENTADO_EM add constraint EQU_APRES_Artig
foreign key (DOI)
references Artigo (DOI);
-- Not implemented
-- alter table Artigo add constraint ID_Artigo_CHK
-- check(exists(select * from APRESENTADO_EM
-- where APRESENTADO_EM.DOI = DOI));
-- Not implemented
-- alter table Artigo add constraint ID_Artigo_CHK
-- check(exists(select * from PUBLICA
-- where PUBLICA.DOI = DOI));
alter table Artigo add constraint EQU_Artig_Comit_FK
foreign key (id_comite)
references Comite_Programa (id_comite);
-- Not implemented
-- alter table Atividade add constraint ID_Atividade_CHK
-- check(exists(select * from Sessao
-- where Sessao.codigo_atividade = codigo_atividade));
-- Not implemented
-- alter table Atividade add constraint ID_Atividade_CHK
-- check(exists(select * from ORGANIZA
-- where ORGANIZA.codigo_atividade = codigo_atividade));
alter table Atividade add constraint EQU_Ativi_Event_FK
foreign key (id_evento)
references Evento (id_evento);
alter table Atividade_social add constraint ID_Ativi_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
-- Not implemented
-- alter table Autor_Artigo add constraint ID_Autor_Parti_CHK
-- check(exists(select * from PUBLICA
-- where PUBLICA.cpf = cpf));
alter table Autor_Artigo add constraint ID_Autor_Parti_FK
foreign key (cpf)
references Participante (cpf);
-- Not implemented
-- alter table Avaliador add constraint ID_Avali_Parti_CHK
-- check(exists(select * from JULGA
-- where JULGA.cpf = cpf));
alter table Avaliador add constraint ID_Avali_Parti_FK
foreign key (cpf)
references Participante (cpf);
-- Not implemented
-- alter table Canal_informativo add constraint ID_Canal_informativo_CHK
-- check(exists(select * from Mobilizador_caravana
-- where Mobilizador_caravana.Id_canal = Id_canal));
-- Not implemented
-- alter table Canal_informativo add constraint ID_Canal_informativo_CHK
-- check(exists(select * from DIVULGA
-- where DIVULGA.Id_canal = Id_canal));
alter table Canal_informativo add constraint FKINFORMA_SOBRE_FK
foreign key (Nome_caravana)
references Caravana (Nome_caravana);
-- Not implemented
-- alter table Caravana add constraint ID_Caravana_CHK
-- check(exists(select * from Participante_caravana
-- where Participante_caravana.Nome_caravana = Nome_caravana));
-- Not implemented
-- alter table Caravana add constraint ID_Caravana_CHK
-- check(exists(select * from Canal_informativo
-- where Canal_informativo.Nome_caravana = Nome_caravana));
-- Not implemented
-- alter table Caravana add constraint ID_Caravana_CHK
-- check(exists(select * from Veiculo
-- where Veiculo.Nome_caravana = Nome_caravana));
-- Not implemented
-- alter table Caravana add constraint ID_Caravana_CHK
-- check(exists(select * from Mobilizador_caravana
-- where Mobilizador_caravana.Nome_caravana = Nome_caravana));
alter table Caravana add constraint FKPARTE_DE_FK
foreign key (Id_local)
references Local_origem (Id_local);
-- Not implemented
-- alter table Certificado add constraint ID_Certificado_CHK
-- check(exists(select * from tipo_participante
-- where tipo_participante.numero_certificado = numero_certificado));
alter table Certificado add constraint EQU_Certi_Organ_FK
foreign key (cnpj)
references Organizadora (cnpj);
alter table Certificado add constraint SID_Certi_Parti_FK
foreign key (cpf)
references Participante (cpf);
-- Not implemented
-- alter table Comite_Programa add constraint ID_Comite_Programa_CHK
-- check(exists(select * from COMPOE
-- where COMPOE.id_comite = id_comite));
-- Not implemented
-- alter table Comite_Programa add constraint ID_Comite_Programa_CHK
-- check(exists(select * from Artigo
-- where Artigo.id_comite = id_comite));
alter table COMPOE add constraint REF_COMPO_Organ_FK
foreign key (cpf)
references Organizador (cpf);
alter table COMPOE add constraint EQU_COMPO_Comit
foreign key (id_comite)
references Comite_Programa (id_comite);
-- Not implemented
-- alter table Concurso add constraint ID_Concu_Ativi_CHK
-- check(exists(select * from participantes_concurso
-- where participantes_concurso.codigo_atividade = codigo_atividade));
-- Not implemented
-- alter table Concurso add constraint ID_Concu_Ativi_CHK
-- check(exists(select * from premiacao_concurso
-- where premiacao_concurso.codigo_atividade = codigo_atividade));
-- Not implemented
-- alter table Concurso add constraint ID_Concu_Ativi_CHK
-- check(exists(select * from regras_concurso
-- where regras_concurso.codigo_atividade = codigo_atividade));
-- Not implemented
-- alter table Concurso add constraint ID_Concu_Ativi_CHK
-- check(exists(select * from JULGA
-- where JULGA.codigo_atividade = codigo_atividade));
alter table Concurso add constraint ID_Concu_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
alter table CONDUZ add constraint EQU_CONDU_Instr_FK
foreign key (cpf)
references Instrutor (cpf);
alter table CONDUZ add constraint EQU_CONDU_Works
foreign key (codigo_atividade)
references Workshop (codigo_atividade);
alter table CONTRATA add constraint ID_CONTR_Organ_FK
foreign key (cpf)
references Organizador (cpf);
alter table CONTRATA add constraint EQU_CONTR_Organ_FK
foreign key (cnpj)
references Organizadora (cnpj);
alter table Contrato add constraint EQU_Contr_Patro_FK
foreign key (cnpj)
references Patrocinadora (cnpj);
alter table Contrato add constraint REF_Contr_Organ_FK
foreign key (C_O_cnpj)
references Organizadora (cnpj);
alter table DIVULGA add constraint FKDIV_Org
foreign key (cpf)
references Organizador (cpf);
alter table DIVULGA add constraint FKDIV_Can_FK
foreign key (Id_canal)
references Canal_informativo (Id_canal);
-- Not implemented
-- alter table Entidade add constraint ID_Entidade_CHK
-- check(exists(select * from REPRESENTA
-- where REPRESENTA.cnpj = cnpj));
alter table Entidade add constraint LSTONE_Entidade
check(Promotora is not null or Organizadora is not null or Patrocinadora is not null);
alter table Equipamento add constraint REF_Equip_Local_FK
foreign key (codigo_local)
references Local_atividade (codigo_local);
-- Not implemented
-- alter table Evento add constraint ID_Evento_CHK
-- check(exists(select * from Atividade
-- where Atividade.id_evento = id_evento));
-- Not implemented
-- alter table Evento add constraint ID_Evento_CHK
-- check(exists(select * from FAZ_LOCACAO
-- where FAZ_LOCACAO.id_evento = id_evento));
-- Not implemented
-- alter table Evento add constraint ID_Evento_CHK
-- check(exists(select * from Movimentacao_Financeira
-- where Movimentacao_Financeira.id_evento = id_evento));
-- Not implemented
-- alter table Evento add constraint ID_Evento_CHK
-- check(exists(select * from Rede_Social
-- where Rede_Social.id_evento = id_evento));
alter table Evento add constraint EQU_Event_Organ_FK
foreign key (cnpj)
references Organizadora (cnpj);
alter table Evento add constraint EQU_Event_Promo_FK
foreign key (PRO_cnpj)
references Promotora (cnpj);
alter table FAZ_LOCACAO add constraint EQU_FAZ_L_Local_FK
foreign key (id_local)
references Local (id_local);
alter table FAZ_LOCACAO add constraint SID_FAZ_L_Event_FK
foreign key (id_evento)
references Evento (id_evento);
alter table INGRESSO add constraint EQU_INGRE_Parti_FK
foreign key (cpf)
references Participante (cpf);
alter table INGRESSO add constraint SID_INGRE_Lote_FK
foreign key (numero_lote)
references Lote (numero_lote);
alter table INGRESSO add constraint REF_INGRE_Event_FK
foreign key (id_evento)
references Evento (id_evento);
alter table INSCREVE add constraint REF_INSCR_Ouvin_FK
foreign key (cpf)
references Ouvinte (cpf);
alter table INSCREVE add constraint REF_INSCR_Ativi
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
-- Not implemented
-- alter table Instrutor add constraint ID_Instr_Parti_CHK
-- check(exists(select * from CONDUZ
-- where CONDUZ.cpf = cpf));
alter table Instrutor add constraint ID_Instr_Parti_FK
foreign key (cpf)
references Participante (cpf);
alter table JULGA add constraint EQU_JULGA_Avali_FK
foreign key (cpf)
references Avaliador (cpf);
alter table JULGA add constraint EQU_JULGA_Concu
foreign key (codigo_atividade)
references Concurso (codigo_atividade);
-- Not implemented
-- alter table Local add constraint ID_Local_CHK
-- check(exists(select * from Local_atividade
-- where Local_atividade.id_local = id_local));
-- Not implemented
-- alter table Local add constraint ID_Local_CHK
-- check(exists(select * from FAZ_LOCACAO
-- where FAZ_LOCACAO.id_local = id_local));
alter table Local add constraint LSTONE_Local
check(Local_presencial is not null or Local_online is not null);
alter table Local_atividade add constraint EQU_Local_Local_FK
foreign key (id_local)
references Local (id_local);
alter table Local_online add constraint ID_Local_Local_1_FK
foreign key (id_local)
references Local (id_local);
-- Not implemented
-- alter table Local_origem add constraint ID_Local_origem_CHK
-- check(exists(select * from Caravana
-- where Caravana.Id_local = Id_local));
alter table Local_presencial add constraint ID_Local_Local_FK
foreign key (id_local)
references Local (id_local);
-- Not implemented
-- alter table Lote add constraint ID_Lote_CHK
-- check(exists(select * from INGRESSO
-- where INGRESSO.numero_lote = numero_lote));
alter table MINISTRA add constraint EQU_MINIS_Minis_FK
foreign key (cpf)
references Ministrante_tutoria (cpf);
alter table MINISTRA add constraint EQU_MINIS_Tutor
foreign key (codigo_atividade)
references Tutoria (codigo_atividade);
-- Not implemented
-- alter table Ministrante_tutoria add constraint ID_Minis_Parti_CHK
-- check(exists(select * from MINISTRA
-- where MINISTRA.cpf = cpf));
alter table Ministrante_tutoria add constraint ID_Minis_Parti_FK
foreign key (cpf)
references Participante (cpf);
alter table Mobilizador_caravana add constraint FKCOORDENA_FK
foreign key (COO_CPF)
references Organizador (CPF);
alter table Mobilizador_caravana add constraint FKResponsavel_por_FK
foreign key (Nome_caravana)
references Caravana (Nome_caravana);
alter table Mobilizador_caravana add constraint FKTERCEIRIZA_FK
foreign key (cnpj)
references Organizadora (cnpj);
alter table Mobilizador_caravana add constraint FKADMINISTRA_FK
foreign key (Id_canal)
references Canal_informativo (Id_canal);
-- Not implemented
-- alter table Movimentacao_Financeira add constraint ID_Movimentacao_Financeira_CHK
-- check(exists(select * from Nota_Fiscal
-- where Nota_Fiscal.codigo_movimentacao = codigo_movimentacao));
alter table Movimentacao_Financeira add constraint EQU_Movim_Event_FK
foreign key (id_evento)
references Evento (id_evento);
alter table Nota_Fiscal add constraint SID_Nota__Movim_FK
foreign key (codigo_movimentacao)
references Movimentacao_Financeira (codigo_movimentacao);
alter table ORGANIZA add constraint EQU_ORGAN_Staff_FK
foreign key (cpf)
references Staff (cpf);
alter table ORGANIZA add constraint EQU_ORGAN_Ativi
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
-- Not implemented
-- alter table Organizador add constraint ID_Organ_Parti_CHK
-- check(exists(select * from DIVULGA
-- where DIVULGA.cpf = cpf));
-- Not implemented
-- alter table Organizador add constraint ID_Organ_Parti_CHK
-- check(exists(select * from CONTRATA
-- where CONTRATA.cpf = cpf));
alter table Organizador add constraint ID_Organ_Parti_FK
foreign key (cpf)
references Participante (cpf);
-- Not implemented
-- alter table Organizadora add constraint ID_Organ_Entid_CHK
-- check(exists(select * from Certificado
-- where Certificado.cnpj = cnpj));
-- Not implemented
-- alter table Organizadora add constraint ID_Organ_Entid_CHK
-- check(exists(select * from Evento
-- where Evento.cnpj = cnpj));
-- Not implemented
-- alter table Organizadora add constraint ID_Organ_Entid_CHK
-- check(exists(select * from CONTRATA
-- where CONTRATA.cnpj = cnpj));
alter table Organizadora add constraint ID_Organ_Entid_FK
foreign key (cnpj)
references Entidade (cnpj);
alter table Ouvinte add constraint ID_Ouvin_Parti_FK
foreign key (cpf)
references Participante (cpf);
-- Not implemented
-- alter table Palestra add constraint ID_Pales_Ativi_CHK
-- check(exists(select * from APRESENTA
-- where APRESENTA.codigo_atividade = codigo_atividade));
alter table Palestra add constraint ID_Pales_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
-- Not implemented
-- alter table Palestrante add constraint ID_Pales_Parti_CHK
-- check(exists(select * from APRESENTA
-- where APRESENTA.cpf = cpf));
alter table Palestrante add constraint ID_Pales_Parti_FK
foreign key (cpf)
references Participante (cpf);
-- Not implemented
-- alter table Participante add constraint ID_Participante_CHK
-- check(exists(select * from Certificado
-- where Certificado.cpf = cpf));
-- Not implemented
-- alter table Participante add constraint ID_Participante_CHK
-- check(exists(select * from INGRESSO
-- where INGRESSO.cpf = cpf));
alter table Participante add constraint LSTONE_Participante
check(Organizador is not null or Instrutor is not null or Avaliador is not null or Autor_Artigo is not null or Staff is not null or Ministrante_tutoria is not null or Palestrante is not null or Ouvinte is not null);
alter table Participante_caravana add constraint FKPar_Par_FK
foreign key (cpf)
references Participante (cpf);
alter table Participante_caravana add constraint FKPARTICIPA_FK
foreign key (Nome_caravana)
references Caravana (Nome_caravana);
alter table participantes_concurso add constraint EQU_parti_Concu
foreign key (codigo_atividade)
references Concurso (codigo_atividade);
alter table participantes_reuniao add constraint EQU_parti_Reuni
foreign key (codigo_atividade)
references Reuniao (codigo_atividade);
alter table PATROCINA add constraint REF_PATRO_Event
foreign key (id_evento)
references Evento (id_evento);
alter table PATROCINA add constraint EQU_PATRO_Patro_FK
foreign key (cnpj)
references Patrocinadora (cnpj);
-- Not implemented
-- alter table Patrocinadora add constraint ID_Patro_Entid_CHK
-- check(exists(select * from PATROCINA
-- where PATROCINA.cnpj = cnpj));
-- Not implemented
-- alter table Patrocinadora add constraint ID_Patro_Entid_CHK
-- check(exists(select * from Contrato
-- where Contrato.cnpj = cnpj));
alter table Patrocinadora add constraint ID_Patro_Entid_FK
foreign key (cnpj)
references Entidade (cnpj);
alter table premiacao_concurso add constraint EQU_premi_Concu
foreign key (codigo_atividade)
references Concurso (codigo_atividade);
-- Not implemented
-- alter table Promotora add constraint ID_Promo_Entid_CHK
-- check(exists(select * from Rede_Social
-- where Rede_Social.cnpj = cnpj));
-- Not implemented
-- alter table Promotora add constraint ID_Promo_Entid_CHK
-- check(exists(select * from Evento
-- where Evento.PRO_cnpj = cnpj));
alter table Promotora add constraint ID_Promo_Entid_FK
foreign key (cnpj)
references Entidade (cnpj);
alter table PUBLICA add constraint EQU_PUBLI_Artig
foreign key (DOI)
references Artigo (DOI);
alter table PUBLICA add constraint EQU_PUBLI_Autor_FK
foreign key (cpf)
references Autor_Artigo (cpf);
alter table Rede_Social add constraint EQU_Rede__Event_FK
foreign key (id_evento)
references Evento (id_evento);
alter table Rede_Social add constraint EQU_Rede__Promo_FK
foreign key (cnpj)
references Promotora (cnpj);
alter table regras_concurso add constraint EQU_regra_Concu
foreign key (codigo_atividade)
references Concurso (codigo_atividade);
alter table REPRESENTA add constraint EQU_REPRE_Repre
foreign key (cpf_representante)
references Representante (cpf_representante);
alter table REPRESENTA add constraint EQU_REPRE_Entid_FK
foreign key (cnpj)
references Entidade (cnpj);
-- Not implemented
-- alter table Representante add constraint ID_Representante_CHK
-- check(exists(select * from REPRESENTA
-- where REPRESENTA.cpf_representante = cpf_representante));
-- Not implemented
-- alter table Reuniao add constraint ID_Reuni_Ativi_CHK
-- check(exists(select * from participantes_reuniao
-- where participantes_reuniao.codigo_atividade = codigo_atividade));
alter table Reuniao add constraint ID_Reuni_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
alter table Sessao add constraint EQU_Sessa_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
alter table Sessao add constraint REF_Sessa_Local_FK
foreign key (codigo_local)
references Local_atividade (codigo_local);
-- Not implemented
-- alter table Sessao_artigo add constraint ID_Sessa_Ativi_CHK
-- check(exists(select * from APRESENTADO_EM
-- where APRESENTADO_EM.codigo_atividade = codigo_atividade));
alter table Sessao_artigo add constraint ID_Sessa_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
-- Not implemented
-- alter table Staff add constraint ID_Staff_Parti_CHK
-- check(exists(select * from ORGANIZA
-- where ORGANIZA.cpf = cpf));
alter table Staff add constraint ID_Staff_Parti_FK
foreign key (cpf)
references Participante (cpf);
alter table tipo_participante add constraint EQU_tipo__Certi
foreign key (numero_certificado)
references Certificado (numero_certificado);
-- Not implemented
-- alter table Tutoria add constraint ID_Tutor_Ativi_CHK
-- check(exists(select * from MINISTRA
-- where MINISTRA.codigo_atividade = codigo_atividade));
alter table Tutoria add constraint ID_Tutor_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
alter table UTILIZA add constraint REF_UTILI_Equip
foreign key (codigo_equipamento)
references Equipamento (codigo_equipamento);
alter table UTILIZA add constraint REF_UTILI_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
alter table Veiculo add constraint FKTRANSPORTA_FK
foreign key (Nome_caravana)
references Caravana (Nome_caravana);
-- Not implemented
-- alter table Workshop add constraint ID_Works_Ativi_CHK
-- check(exists(select * from CONDUZ
-- where CONDUZ.codigo_atividade = codigo_atividade));
alter table Workshop add constraint ID_Works_Ativi_FK
foreign key (codigo_atividade)
references Atividade (codigo_atividade);
-- Index Section
-- _____________
create unique index ID_APRESENTA_IND
on APRESENTA (codigo_atividade, cpf);
create index EQU_APRES_Pales_IND
on APRESENTA (cpf);
create unique index ID_APRESENTADO_EM_IND
on APRESENTADO_EM (DOI, codigo_atividade);
create index EQU_APRES_Sessa_IND
on APRESENTADO_EM (codigo_atividade);
create unique index ID_Artigo_IND
on Artigo (DOI);
create index EQU_Artig_Comit_IND
on Artigo (id_comite);
create unique index ID_Atividade_IND
on Atividade (codigo_atividade);
create index EQU_Ativi_Event_IND
on Atividade (id_evento);
create unique index ID_Ativi_Ativi_IND
on Atividade_social (codigo_atividade);
create unique index ID_Autor_Parti_IND
on Autor_Artigo (cpf);
create unique index ID_Avali_Parti_IND
on Avaliador (cpf);
create unique index ID_Canal_informativo_IND
on Canal_informativo (Id_canal);
create index FKINFORMA_SOBRE_IND
on Canal_informativo (Nome_caravana);
create unique index ID_Caravana_IND
on Caravana (Nome_caravana);
create index FKPARTE_DE_IND
on Caravana (Id_local);
create unique index ID_Certificado_IND
on Certificado (numero_certificado);
create index EQU_Certi_Organ_IND
on Certificado (cnpj);
create unique index SID_Certi_Parti_IND
on Certificado (cpf);
create unique index ID_Comite_Programa_IND
on Comite_Programa (id_comite);
create unique index ID_COMPOE_IND
on COMPOE (id_comite, cpf);
create index REF_COMPO_Organ_IND
on COMPOE (cpf);
create unique index ID_Concu_Ativi_IND
on Concurso (codigo_atividade);
create unique index ID_CONDUZ_IND
on CONDUZ (codigo_atividade, cpf);
create index EQU_CONDU_Instr_IND
on CONDUZ (cpf);
create unique index ID_CONTR_Organ_IND
on CONTRATA (cpf);
create index EQU_CONTR_Organ_IND
on CONTRATA (cnpj);
create unique index ID_Contrato_IND
on Contrato (id_contrato);
create index EQU_Contr_Patro_IND
on Contrato (cnpj);
create index REF_Contr_Organ_IND
on Contrato (C_O_cnpj);
create unique index ID_DIVULGA_IND
on DIVULGA (cpf, Id_canal);
create index FKDIV_Can_IND
on DIVULGA (Id_canal);
create unique index ID_Entidade_IND
on Entidade (cnpj);
create unique index ID_Equipamento_IND
on Equipamento (codigo_equipamento);
create index REF_Equip_Local_IND
on Equipamento (codigo_local);
create unique index ID_Evento_IND
on Evento (id_evento);
create index EQU_Event_Organ_IND
on Evento (cnpj);
create index EQU_Event_Promo_IND
on Evento (PRO_cnpj);
create unique index ID_FAZ_LOCACAO_IND
on FAZ_LOCACAO (id_contrato);
create index EQU_FAZ_L_Local_IND
on FAZ_LOCACAO (id_local);
create unique index SID_FAZ_L_Event_IND
on FAZ_LOCACAO (id_evento);
create unique index ID_INGRESSO_IND
on INGRESSO (numero_ingresso);
create index EQU_INGRE_Parti_IND
on INGRESSO (cpf);
create index REF_INGRE_Event_IND
on INGRESSO (id_evento);
create unique index ID_INSCREVE_IND
on INSCREVE (codigo_atividade, cpf);
create index REF_INSCR_Ouvin_IND
on INSCREVE (cpf);
create unique index ID_Instr_Parti_IND
on Instrutor (cpf);
create unique index ID_JULGA_IND
on JULGA (codigo_atividade, cpf);
create index EQU_JULGA_Avali_IND
on JULGA (cpf);
create unique index ID_Local_IND
on Local (id_local);
create unique index ID_Local_atividade_IND
on Local_atividade (codigo_local);
create index EQU_Local_Local_IND
on Local_atividade (id_local);
create unique index ID_Local_Local_1_IND
on Local_online (id_local);
create unique index ID_Local_origem_IND
on Local_origem (Id_local);
create unique index ID_Local_Local_IND
on Local_presencial (id_local);
create unique index ID_Lote_IND
on Lote (numero_lote);
create unique index ID_MINISTRA_IND
on MINISTRA (codigo_atividade, cpf);
create index EQU_MINIS_Minis_IND
on MINISTRA (cpf);
create unique index ID_Minis_Parti_IND
on Ministrante_tutoria (cpf);
create unique index ID_Mobilizador_caravana_IND
on Mobilizador_caravana (CPF);
create index FKResponsavel_por_IND
on Mobilizador_caravana (Nome_caravana);
create index FKTERCEIRIZA_IND
on Mobilizador_caravana (cnpj);
create index FKADMINISTRA_IND
on Mobilizador_caravana (Id_canal);
create unique index ID_Movimentacao_Financeira_IND
on Movimentacao_Financeira (codigo_movimentacao);
create index EQU_Movim_Event_IND
on Movimentacao_Financeira (id_evento);
create unique index ID_Nota_Fiscal_IND
on Nota_Fiscal (numero_nota);
create unique index SID_Nota__Movim_IND
on Nota_Fiscal (codigo_movimentacao);
create unique index ID_ORGANIZA_IND
on ORGANIZA (codigo_atividade, cpf);
create index EQU_ORGAN_Staff_IND
on ORGANIZA (cpf);
create unique index ID_Organ_Parti_IND
on Organizador (cpf);
create index FKCOORDENA_IND
on Mobilizador_caravana (COO_CPF);
create unique index ID_Organ_Entid_IND
on Organizadora (cnpj);
create unique index ID_Ouvin_Parti_IND
on Ouvinte (cpf);
create unique index ID_Pales_Ativi_IND
on Palestra (codigo_atividade);
create unique index ID_Pales_Parti_IND
on Palestrante (cpf);
create unique index ID_Participante_IND
on Participante (cpf);
create unique index FKPar_Par_IND
on Participante_caravana (cpf);
create index FKPARTICIPA_IND
on Participante_caravana (Nome_caravana);
create unique index ID_participantes_concurso_IND
on participantes_concurso (codigo_atividade, nome_participante);
create unique index ID_participantes_reuniao_IND
on participantes_reuniao (codigo_atividade, nome_participante);
create unique index ID_PATROCINA_IND
on PATROCINA (id_evento, cnpj);
create index EQU_PATRO_Patro_IND
on PATROCINA (cnpj);
create unique index ID_Patro_Entid_IND
on Patrocinadora (cnpj);
create unique index ID_premiacao_concurso_IND
on premiacao_concurso (codigo_atividade, premio, colocacao);
create unique index ID_Promo_Entid_IND
on Promotora (cnpj);
create unique index ID_PUBLICA_IND
on PUBLICA (DOI, cpf);
create index EQU_PUBLI_Autor_IND
on PUBLICA (cpf);
create unique index ID_Rede_Social_IND
on Rede_Social (url);
create index EQU_Rede__Event_IND
on Rede_Social (id_evento);
create index EQU_Rede__Promo_IND
on Rede_Social (cnpj);
create unique index ID_regras_concurso_IND
on regras_concurso (codigo_atividade, regra);
create unique index ID_REPRESENTA_IND
on REPRESENTA (cpf_representante, cnpj);
create index EQU_REPRE_Entid_IND
on REPRESENTA (cnpj);
create unique index ID_Representante_IND
on Representante (cpf_representante);
create unique index ID_Reuni_Ativi_IND
on Reuniao (codigo_atividade);
create index EQU_Sessa_Ativi_IND
on Sessao (codigo_atividade);
create index REF_Sessa_Local_IND
on Sessao (codigo_local);
create unique index SID_Sessao_IND
on Sessao (data_inicio);
create unique index ID_Sessa_Ativi_IND
on Sessao_artigo (codigo_atividade);
create unique index ID_Staff_Parti_IND
on Staff (cpf);
create unique index ID_tipo_participante_IND
on tipo_participante (numero_certificado, tipo_participante);
create unique index ID_Tutor_Ativi_IND
on Tutoria (codigo_atividade);
create unique index ID_UTILIZA_IND
on UTILIZA (codigo_equipamento, codigo_atividade);
create index REF_UTILI_Ativi_IND
on UTILIZA (codigo_atividade);
create unique index ID_Veiculo_IND
on Veiculo (Codigo_veiculo);
create index FKTRANSPORTA_IND
on Veiculo (Nome_caravana);
create unique index ID_Works_Ativi_IND
on Workshop (codigo_atividade);
use eventos_cientificos;
/* Inserção Parte 1 */
/* Inserção Dados Entidade */
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (37159434000115, "Avenida dos Imigrantes", "Bragança Paulista", "São Paulo", "12903-130", "150", "Promotora de Eventos S.A", "eventossa@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", true, false, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (21246221000199, "Avenida Paulista", "São Paulo", "São Paulo", "03619-130", "100", "Promotora de Eventos SP", "eventossp@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", true, false, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (84963187000151, "Rua das Maritacas", "Bragança Paulista", "São Paulo", "12903-160", "100", "Promotora Bragança Eventos", "brageventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", true, false, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (19741351000141, "Rua Operação", "São Paulo", "São Paulo", "05655-130", "99", "Promotora Cubatão Eventos", "cubataoeventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", true, false, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (39716013000120, "Rua Teresópolis", "Rio de Janeiro", "Rio de Janeiro", "94443-456", "37", "Promotora Confort Eventos", "conforteventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", true, false, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (11524184000187, "Rua Almeida", "Rio de Janeiro", "Rio de Janeiro", "94446-446", "27", "Zalinha Eventos", "zalinhaventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, false, true);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (29532264000178, "Avenida Operária", "São Paulo", "São Paulo", "03567-456", "17", "Zen Eventos", "zeneventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, false, true);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (14578574000156, "Rua Hernandes", "São Paulo", "São Paulo", "05567-456", "493", "Dalaz Eventos", "dalazeventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, false, true);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (27349772000111, "Rua Fernandópolis", "Fernandópolis", "São Paulo", "95867-456", "3793", "Biro Eventos", "biroeventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, false, true);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora)
VALUES (07755256000158, "Rua Aparecida", "Rio de Janeiro", "Rio de Janeiro", "94443-434", "37562", "RJ Eventos", "rjeventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, false, true);
/* Inserção Dados Promotora */
INSERT INTO promotora (cnpj) VALUES (37159434000115);
INSERT INTO promotora (cnpj) VALUES (21246221000199);
INSERT INTO promotora (cnpj) VALUES (84963187000151);
INSERT INTO promotora (cnpj) VALUES (19741351000141);
INSERT INTO promotora (cnpj) VALUES (39716013000120);
/* Inserção Dados Organizadora */
INSERT INTO organizadora (cnpj) VALUES (11524184000187);
INSERT INTO organizadora (cnpj) VALUES (29532264000178);
INSERT INTO organizadora (cnpj) VALUES (14578574000156);
INSERT INTO organizadora (cnpj) VALUES (27349772000111);
INSERT INTO organizadora (cnpj) VALUES (07755256000158);
/* Inserção Dados Evento */
INSERT INTO evento (tema, edicao, nome, data_inicio, data_fim, cnpj, PRO_cnpj) VALUES ("Nutricao", 26, "CONBRAN 2020 - XXVI Congresso Brasileiro de Nutrição", '2021-01-19', '2021-01-22', 11524184000187, 37159434000115);
INSERT INTO evento (tema, edicao, nome, data_inicio, data_fim, cnpj, PRO_cnpj) VALUES ("Computacao", 40, "XL Congresso da Sociedade Brasileira de Computação", '2020-11-16', '2020-11-20', 29532264000178, 21246221000199);
INSERT INTO evento (tema, edicao, nome, data_inicio, data_fim, cnpj, PRO_cnpj) VALUES ("Contabilidade", 1, "CONBCON - Congresso Online Brasileiro de Contabilidade", '2020-09-21', '2020-09-25', 14578574000156, 84963187000151);
INSERT INTO evento (tema, edicao, nome, data_inicio, data_fim, cnpj, PRO_cnpj) VALUES ("Direito", 34, "XXXIV Congresso Brasileiro de Direito Administrativo", '2020-11-04', '2020-11-07', 27349772000111, 19741351000141);
INSERT INTO evento (tema, edicao, nome, data_inicio, data_fim, cnpj, PRO_cnpj) VALUES ("Psicologia", 18, "XVIII Congresso Brasileiro do Sono", '2021-06-03', '2021-06-05', 07755256000158, 39716013000120);
INSERT INTO evento (tema, edicao, nome, data_inicio, data_fim, cnpj, PRO_cnpj) VALUES
("Computacao", 6, "VI Evento de Computacao", '2021-01-19', '2021-01-22', 11524184000187, 37159434000115),
("Computacao", 16, "Semana de Sistemas de informação", '2020-11-16', '2020-11-20', 29532264000178, 21246221000199),
("Contabilidade", 44, "Congresso Brasileiro de Contabilidade", '2020-09-21', '2020-09-25', 14578574000156, 84963187000151),
("Direito", 26, "XXVI Congresso Brasileiro de Direito", '2020-11-04', '2020-11-07', 27349772000111, 19741351000141),
("Engenharia", 15, "XV Congresso Brasileiro do De Petróleo", '2021-06-03', '2021-06-05', 07755256000158, 39716013000120);
/* Inserção Dados Movimentacao_Financeira */
INSERT INTO movimentacao_financeira (tipo, descricao, valor_a_pagar, quantidade, id_evento) VALUES ("Despesa", "aluguel_local", 10.000, 1, 2);
INSERT INTO movimentacao_financeira (tipo, descricao, valor_a_pagar, quantidade, id_evento) VALUES ("Receita", "ingressos_pre_venda", 70, 100, 2);
INSERT INTO movimentacao_financeira (tipo, descricao, valor_a_pagar, quantidade, id_evento) VALUES ("Despesa", "premiacao_concurso", 1.000, 5, 2);
INSERT INTO movimentacao_financeira (tipo, descricao, valor_a_pagar, quantidade, id_evento) VALUES ("Despesa", "aluguel_cadeiras", 3.000, 1.000, 2);
INSERT INTO movimentacao_financeira (tipo, descricao, valor_a_pagar, quantidade, id_evento) VALUES ("Receita", "ingresos_primeiro_lote", 80, 200, 2);
/* Inserção Dados Nota_Fiscal */
INSERT INTO nota_fiscal (codigo_movimentacao, cnpj_emissor, nome_razao_social, inscricao_municipal, codigo_verificacao, valor, data_emissao) VALUES (1, 15461510000133, "Universidade Federal de Mato Grosso", 79241589, "WCA-7MKD", 10.000, '2020-09-15');
INSERT INTO nota_fiscal (codigo_movimentacao, cnpj_emissor, nome_razao_social, inscricao_municipal, codigo_verificacao, valor, data_emissao) VALUES (2, 21246221000199, "Promotora Root", 25416899, "PKE-5BDE", 7.000, '2020-04-25');
INSERT INTO nota_fiscal (codigo_movimentacao, cnpj_emissor, nome_razao_social, inscricao_municipal, codigo_verificacao, valor, data_emissao) VALUES (3, 15436940000103, "Amazon", 29871659, "WKY-7LBJ", 1.000, '2020-09-09');
INSERT INTO nota_fiscal (codigo_movimentacao, cnpj_emissor, nome_razao_social, inscricao_municipal, codigo_verificacao, valor, data_emissao) VALUES (4, 16428221000140, "Cadeiras Conforto", 24539811, "KFD-DFW",3.000, '2020-09-10');
INSERT INTO nota_fiscal (codigo_movimentacao, cnpj_emissor, nome_razao_social, inscricao_municipal, codigo_verificacao, valor, data_emissao) VALUES (5, 21246221000199, "Promotora Root", 25416899, "CDG-4RFD", 16.000, '2020-09-25');
/* Inserção Dados Local */
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("YouTube", 500, true, false);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("Universidade Federal de Mato Grosso", 10.000, false, true);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("Google Meets", 500, true, false);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("YouTube", 500, true, false);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("Centro de Convenções Frei Caneca", 20.000, false, true);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("Twitch", 500, true, false);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("Zoom", 500, true, false);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("Pavilhão Anhembi", 20.000, false, true);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("São Paulo Expo", 20.000, false, true);
INSERT INTO local (nome, valor_locacao, Local_online, Local_presencial) VALUES ("Expo Center Norte", 20.000, false, true);
INSERT INTO Local (nome, valor_locacao, Local_online, Local_presencial) VALUES
("Universidade Federal do Ceará", 0, false, true),
("Universidade Federal de Alagoas", 0, false, true),
("Centro de Eventos do Ceará", 1000, false, true),
("Universidade Federal de Sergipe", 25, false, true),
("Fundação Oswaldo Cruz - Ceará", 0, false, true);
/* Inserção Dados Local_Presencial */
INSERT INTO local_presencial (id_local, end_logradouro, end_cidade, end_estado, end_cep, end_numero, capacidade, area) VALUES (2, "Rua Quarenta e Nove - Boa Esperança", "Cuiabá", "Mato Grosso", "78060-900", "2367", 1000, 149.000);
INSERT INTO local_presencial (id_local, end_logradouro, end_cidade, end_estado, end_cep, end_numero, capacidade, area) VALUES (5, "Rua Frei Caneca - Consolação", "São Paulo", "São Paulo", "01307-001", "569", 3800, 10.500);
INSERT INTO local_presencial (id_local, end_logradouro, end_cidade, end_estado, end_cep, end_numero, capacidade, area) VALUES (8, "Avenida Olavo Fontoura - Santana", "São Paulo", "São Paulo", "02012-021", "1209", 30000, 100.000);
INSERT INTO local_presencial (id_local, end_logradouro, end_cidade, end_estado, end_cep, end_numero, capacidade, area) VALUES (9, "Rod. dos Imigrantes - Vila Água Funda", "São Paulo", "São Paulo", "04329-900", "1,5", 7810, 14.000);
INSERT INTO local_presencial (id_local, end_logradouro, end_cidade, end_estado, end_cep, end_numero, capacidade, area) VALUES (10, "Rua José Bernardo Pinto - Vila Guilherme", "São Paulo", "São Paulo", "02055-000", "333", 4500, 98.000);
INSERT INTO local_presencial (id_local, end_logradouro, end_cidade, end_estado, end_cep, end_numero, capacidade, area) VALUES
(11, "Avenida da Universidade", "Fortaleza", "Ceará", "06640-450", "2853", 1200, 259.000),
(12, "Av. Lourival Melo Mota", "Maceió", "Alagoas", "45807-001", "1000", 3800, 1400),
(13, "Av. Washington Soares", "Fortaleza", "Ceará", "25982-741", "999", 30000, 100.000),
(14, "Av. Marechal Rondon", "Maceió", "Alagoas", "65129-954", "15", 7810, 14.000),
(15, "Rua São José", "Fortaleza", "Ceará", "05544-201", "3240", 4500, 98.000);
/* Inserção Dados Local_Online */
INSERT INTO local_online (id_local, url) VALUES (1, "https://www.youtube.com/watch?v=WmKrw7pT-7s");
INSERT INTO local_online (id_local, url) VALUES (3, "https://meet.google.com/amc-jtyw-rel");
INSERT INTO local_online (id_local, url) VALUES (4, "https://www.youtube.com/watch?v=YhTry7pT-6r");
INSERT INTO local_online (id_local, url) VALUES (6, "http://twitch.tv/congresso_jogos");
INSERT INTO local_online (id_local, url) VALUES (7, "https://us02web.zoom.us/j/82815666367?pwd=RDVnYUR5Um54b0pmUGVCYjRWRklFdz09");
/* Inserção Dados Faz_Locacao */
INSERT INTO faz_locacao (id_contrato, id_evento, data_inicio, data_fim, valor, id_local) VALUES (1, 1, '2021-01-19', '2021-01-22', 500, 1);
INSERT INTO faz_locacao (id_contrato, id_evento, data_inicio, data_fim, valor, id_local) VALUES (2, 2, '2020-11-16', '2020-11-20', 10.000, 2);
INSERT INTO faz_locacao (id_contrato, id_evento, data_inicio, data_fim, valor, id_local) VALUES (3, 3, '2020-09-21', '2020-09-25', 500, 3);
INSERT INTO faz_locacao (id_contrato, id_evento, data_inicio, data_fim, valor, id_local) VALUES (4, 4, '2020-11-04', '2020-11-07', 500, 4);
INSERT INTO faz_locacao (id_contrato, id_evento, data_inicio, data_fim, valor, id_local) VALUES (5, 5, '2021-06-03', '2021-06-05', 20.000, 5);
INSERT INTO faz_locacao (id_contrato, id_evento, data_inicio, data_fim, valor, id_local) VALUES
(6, 6, '2020-05-19', '2021-01-22', 5000, 11),
(7, 7, '2019-04-19', '2021-02-05', 550, 12),
(8, 8, '2020-11-19', '2021-12-14', 0, 13),
(9, 9, '2021-09-19', '2022-10-25', 40, 14),
(10, 10, '2021-07-19', '2022-04-02', 555, 15);
/* Inserção Dados Local_Atividade */
INSERT INTO local_atividade (nome, capacidade, id_local) VALUES ("Sala 121", 70, 2);
INSERT INTO local_atividade (nome, capacidade, id_local) VALUES ("Sala 122", 70, 2);
INSERT INTO local_atividade (nome, capacidade, id_local) VALUES ("Auditório Azul", 200, 2);
INSERT INTO local_atividade (nome, capacidade, id_local) VALUES ("Auditório Verde", 250, 2);
INSERT INTO local_atividade (nome, capacidade, id_local) VALUES ("Laboratório 13", 70, 2);
/* Inserção Dados Equipamento */
INSERT INTO equipamento (nome, valor, codigo_local) VALUES ("Microfone", 400, 3);
INSERT INTO equipamento (nome, valor, codigo_local) VALUES ("Microfone", 400, 4);
INSERT INTO equipamento (nome, valor, codigo_local) VALUES ("Computador", 3.000, 5);
INSERT INTO equipamento (nome, valor, codigo_local) VALUES ("Projetor", 700, 1);
INSERT INTO equipamento (nome, valor, codigo_local) VALUES ("Projetor", 700, 2);
/* Inserção Dados Atividade */
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Workshop Inteligência Artificial com Sistemas HPCC", 2, "Workshop");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Sessão de Artigos sobre Machine Learning", 2, "Sessão_Artigo");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Palestra: Deep Learning no dia a dia ", 2, "Palestra");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Palestra: Arquitetura de Super Computadores", 2, "Palestra");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Workshop Computação Quântica", 2, "Workshop");
/* Inserção Dados Sessao */
INSERT INTO sessao (data_inicio, data_fim, codigo_atividade, codigo_local) VALUES ('2020-11-16', '2020-11-16', 1, 1);
INSERT INTO sessao (data_inicio, data_fim, codigo_atividade, codigo_local) VALUES ('2020-11-18', '2020-11-18', 2, 2);
INSERT INTO sessao (data_inicio, data_fim, codigo_atividade, codigo_local) VALUES ('2020-11-20', '2020-11-20', 3, 3);
INSERT INTO sessao (data_inicio, data_fim, codigo_atividade, codigo_local) VALUES ('2020-11-19', '2020-11-19', 4, 4);
INSERT INTO sessao (data_inicio, data_fim, codigo_atividade, codigo_local) VALUES ('2020-11-17', '2020-11-20', 5, 5);
/* Inserção Dados Utiliza. */
INSERT INTO utiliza (codigo_atividade, codigo_equipamento, quantidade) VALUES (3, 1, 3);
INSERT INTO utiliza (codigo_atividade, codigo_equipamento, quantidade) VALUES (4, 2, 3);
INSERT INTO utiliza (codigo_atividade, codigo_equipamento, quantidade) VALUES (5, 3, 20);
INSERT INTO utiliza (codigo_atividade, codigo_equipamento, quantidade) VALUES (1, 4, 1);
INSERT INTO utiliza (codigo_atividade, codigo_equipamento, quantidade) VALUES (2, 5, 1);
/* Inserção Parte 2 */
/* Inserção Dados Atividade - atividade social */
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Jantar beneficente", 2, "Atividade_social");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Distribuição de brindes tecnológicos", 2, "Atividade_social");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Coffe Break analitico", 3, "Atividade_social");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Coquetel de abertura", 2, "Atividade_social");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Coquetel de encerramento com brindes", 2, "Atividade_social");
/* Inserção Dados Atividade_social */
INSERT INTO atividade_social (codigo_atividade, tipo, valor_convite) VALUES (6, "Jantar beneficente", 10);
INSERT INTO atividade_social (codigo_atividade, tipo, valor_convite) VALUES (7, "Espaço do patrocinador", 0);
INSERT INTO atividade_social (codigo_atividade, tipo, valor_convite) VALUES (8, "Coffee break", 5);
INSERT INTO atividade_social (codigo_atividade, tipo, valor_convite) VALUES (9, "Coquetel", 10);
INSERT INTO atividade_social (codigo_atividade, tipo, valor_convite) VALUES (10, "Coquetel", 10);
/* Inserção Dados Atividade - reuniao */
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Elementos constituintes do ovo", 1, "reuniao");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Impostos e regulação fiscal", 3, "reuniao");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Modelos de Inteligência Artificial e Ética", 2, "reuniao");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Objetivos da computação quântica", 2, "reuniao");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Financiamento de um supercomputador brasileiro", 2, "reuniao");
/* Inserção Dados reuniao */
INSERT INTO reuniao (codigo_atividade, objetivo) VALUES (11, "Discutir a composição do ovo");
INSERT INTO reuniao (codigo_atividade, objetivo) VALUES (12, "Discutir uma nova regulação fiscal");
INSERT INTO reuniao (codigo_atividade, objetivo) VALUES (13, "Discutir o papel da ética nos modelos de IA");
INSERT INTO reuniao (codigo_atividade, objetivo) VALUES (14, "Fomentar a discussao sobre computação quântica");
INSERT INTO reuniao (codigo_atividade, objetivo) VALUES (15, "Discutir o financiamento para um supercomputador brasileiro");
/* Inserção participantes_reuniao */
INSERT INTO participantes_reuniao (codigo_atividade, nome_participante) VALUES (13, "Naruto Uzumaki");
INSERT INTO participantes_reuniao (codigo_atividade, nome_participante) VALUES (13, "Gracyane Barbosa");
INSERT INTO participantes_reuniao (codigo_atividade, nome_participante) VALUES (13, "Chris Rock");
INSERT INTO participantes_reuniao (codigo_atividade, nome_participante) VALUES (13, "Rochelle Rock");
INSERT INTO participantes_reuniao (codigo_atividade, nome_participante) VALUES (13, "Tonya Rock");
/* Inserção Dados Atividade - sessao_artigo */
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Nutrição e coronavirus", 1, "sessao_artigo");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Lei orçamentaria", 3, "sessao_artigo");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Produção científica sobre sistemas complexos", 2, "sessao_artigo");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Papel da tecnologia na pandemia", 2, "sessao_artigo");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Apresentação dos artigos produzidos pelo Programa de Pós-Graduação em SI", 2, "sessao_artigo");
/* Inserção sessão_artigo */
INSERT INTO sessao_artigo (codigo_atividade, tipo, numero_sessoes, responsavel) VALUES (16, "nutrição", 1, "Marcelo Ribeiro");
INSERT INTO sessao_artigo (codigo_atividade, tipo, numero_sessoes, responsavel) VALUES (17, "Finanças publicas", 1, "Renata Flores");
INSERT INTO sessao_artigo (codigo_atividade, tipo, numero_sessoes, responsavel) VALUES (18, "Computação", 1, "Vitoria Regia");
INSERT INTO sessao_artigo (codigo_atividade, tipo, numero_sessoes, responsavel) VALUES (19, "Computação", 1, "Gisele Silva");
INSERT INTO sessao_artigo (codigo_atividade, tipo, numero_sessoes, responsavel) VALUES (20, "PPG-SI", 1, "Joao Marx");
/* Inserção Dados comite */
INSERT INTO comite_programa(id_comite) VALUES (1);
INSERT INTO comite_programa(id_comite) VALUES (2);
INSERT INTO comite_programa(id_comite) VALUES (3);
INSERT INTO comite_programa(id_comite) VALUES (4);
INSERT INTO comite_programa(id_comite) VALUES (5);
/* Inserção Dados artigo */
INSERT INTO artigo (titulo, DOI, revista_publicacao, id_comite) VALUES ("O impacto da tecnologia no mundo atual", "D55235CBANC", "New England Journal", 1);
INSERT INTO artigo (titulo, DOI, revista_publicacao, id_comite) VALUES ("Descobrindo caminhos na computação", "94RHFJFJKCO", "Revista Brasileira de Computação", 1);
INSERT INTO artigo (titulo, DOI, revista_publicacao, id_comite) VALUES ("Aumento do processamento vs desempenho", "OE974YBNOAQOP", "Nature", 1);
INSERT INTO artigo (titulo, DOI, revista_publicacao, id_comite) VALUES ("A vida de um cientista moderno", "BDHFI3750RJM", "Jornal Brasileiro de Tecnologia", 1);
INSERT INTO artigo (titulo, DOI, revista_publicacao, id_comite) VALUES ("Demanda por desenvolvedores durante a pandemia", "H3546DKVHSJDO", "Jornal Brasileiro de Ciencia de Dados", 1);
/* Inserção Dados apresentado_em */
INSERT INTO apresentado_em (DOI, codigo_atividade) VALUES ("D55235CBANC", 20);
INSERT INTO apresentado_em (DOI, codigo_atividade) VALUES ("94RHFJFJKCO", 20);
INSERT INTO apresentado_em (DOI, codigo_atividade) VALUES ("OE974YBNOAQOP", 20);
INSERT INTO apresentado_em (DOI, codigo_atividade) VALUES ("BDHFI3750RJM", 20);
INSERT INTO apresentado_em (DOI, codigo_atividade) VALUES ("H3546DKVHSJDO", 20);
/* Inserção Dados Atividade - workshop */
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Workshop: alimentação saudavel", 1, "workshop");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Imposto de renda", 3, "workshop");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Workshop: Inteligência Artificial", 2, "workshop");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Workshop: IoT na modernidade", 2, "workshop");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Workshop: mercado de TI", 2, "workshop");
/* Inserção workshop */
INSERT INTO workshop (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (21, 250, "Como ter uma alimentação saudável atualmente", "Geral");
INSERT INTO workshop (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (22, 120, "Como declarar o imposto de renda", "Adultos");
INSERT INTO workshop (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (23, 250, "Imersão na inteligência Artificial", "Cientistas de dados");
INSERT INTO workshop (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (24, 120, "IoT na modernidade", "Adultos");
INSERT INTO workshop (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (25, 150, "Soft skills para o mercado em TI", "Geral");
/* Inserção Dados Atividade - concurso */
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Concurso: melhor receita com beringela", 1, "concurso");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Concurso: melhor receita vegana", 1, "concurso");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Concurso: Visualização de dados", 2, "concurso");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Concurso: Desenvolver um site novo para a Sociedade Brasileira de Computação", 2, "concurso");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Concurso: crianças programadoras", 2, "concurso");
/* Inserção Dados concurso */
INSERT INTO concurso (codigo_atividade, tema) VALUES (26, "Receita com beringela");
INSERT INTO concurso (codigo_atividade, tema) VALUES (27, "Receitas veganas");
INSERT INTO concurso (codigo_atividade, tema) VALUES (28, "Construindo visualizações para dados de reembolsos de alimentação dos deputados federais");
INSERT INTO concurso (codigo_atividade, tema) VALUES (29, "Criando um novo site para a Sociedade Brasileira de Computação");
INSERT INTO concurso (codigo_atividade, tema) VALUES (30, "Gincana de algoritmos básicos para crianças");
/* Inserção Dados premiacao_concurso */
INSERT INTO premiacao_concurso (codigo_atividade, premio, colocacao) VALUES (28, "Console PS5", 1);
INSERT INTO premiacao_concurso (codigo_atividade, premio, colocacao) VALUES (28, "Ipad", 2);
INSERT INTO premiacao_concurso (codigo_atividade, premio, colocacao) VALUES (28, "Us$100", 3);
INSERT INTO premiacao_concurso (codigo_atividade, premio, colocacao) VALUES (29, "Macbook air", 1);
INSERT INTO premiacao_concurso (codigo_atividade, premio, colocacao) VALUES (29, "Us$200", 2);
INSERT INTO premiacao_concurso (codigo_atividade, premio, colocacao) VALUES (30, "Console PS5", 1);
INSERT INTO premiacao_concurso (codigo_atividade, premio, colocacao) VALUES (30, "Console PS4", 2);
INSERT INTO premiacao_concurso (codigo_atividade, premio, colocacao) VALUES (30, "Tablet Samsumg", 3);
/* Inserção Dados participantes_concurso */
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Amanda Silva");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Beatriz Viveiros");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Gracyane Barbosa");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Eloisa Mendes");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Noemia Silva");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Jonas Serafim");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Fatima Bernardes");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Adolfo Ferreira");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (28, "Ana Maria Braga");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (29, "Dorime Maria Souza");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (29, "Olivia Pope");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (29, "Jair Eustaquio");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (30, "Pedro Cabral");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (30, "Guilherme Boulos");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (30, "Enzo Bonner");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (30, "Otavio Fernandes");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (30, "Moises Felipe");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (30, "Marina Rosa");
INSERT INTO participantes_concurso (codigo_atividade, nome_participante) VALUES (30, "Eduardo Souza");
/* Inserção Dados regras_concurso */
INSERT INTO regras_concurso (codigo_atividade, regra) VALUES (28, "Critério de desempate: votação online nas redes sociais do evento");
INSERT INTO regras_concurso (codigo_atividade, regra) VALUES (29, "Será avaliado o melhor layout, de acordo com os juízes");
INSERT INTO regras_concurso (codigo_atividade, regra) VALUES (29, "Critério de desempate: votação online nas redes sociais do evento");
INSERT INTO regras_concurso (codigo_atividade, regra) VALUES (30, "Apenas crianças de até 12 anos");
INSERT INTO regras_concurso (codigo_atividade, regra) VALUES (30, "Critério de desempate: o primeiro a responder a pergunta final");
INSERT INTO regras_concurso (codigo_atividade, regra) VALUES (30, "Participação deve ser utorizada pelos pais ou responsáveis");
/* Inserção Dados Atividade - tutoria */
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Tutoria: aprendendo a cozinhar legumes", 1, "tutoria");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Tutoria: Criando seu primeiro chatbot", 2, "tutoria");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Tutoria: Limpeza e preparação de dados", 2, "tutoria");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Aprenda a usar o Git e Github", 2, "tutoria");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Tutoria: arduíno na prática", 2, "tutoria");
/* Inserção tutoria */
INSERT INTO tutoria (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (31, 15, "Aprenda a cozinhar diversos legumes", "Geral" );
INSERT INTO tutoria (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (32, 20, "Aprendendo fazer um chatbot no Telegram", "Conhecimento básico em programação" );
INSERT INTO tutoria (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (33, 1, "Limpeza e preparação dos dados na prática", "Geral" );
INSERT INTO tutoria (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (34, 50, "Aprendendo a usar o Git - Github", "Conhecimento básico em programação");
INSERT INTO tutoria (codigo_atividade, valor_inscricao, tema, publico_alvo) VALUES (35, 60, "Arduíno na prática", "Conhecimento básico em programação");
/* Inserção Dados Atividade - palestra */
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Palestra: agronegócio e alimentação saudavel", 1, "palestra");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Palestra: mudanças tecnológicas", 2, "palestra");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Perspectivas tecnológicas para o futuro", 2, "palestra");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("O impacto dos dados nas decisões corporativas", 2, "palestra");
INSERT INTO atividade (nome, id_evento, tipo_atividade) VALUES ("Visão computacional", 2, "palestra");
/* Inserção Palestra */
INSERT INTO palestra (codigo_atividade, descricao, publico_alvo) VALUES (36, "A relação do agronegócio e da alimentação saudável", "Geral");
INSERT INTO palestra (codigo_atividade, descricao, publico_alvo) VALUES (37, "Mudanças nas tecnologias atuais", "Computação");
INSERT INTO palestra (codigo_atividade, descricao, publico_alvo) VALUES (38, "Previsões das tecnologias do futuro", "Computação");
INSERT INTO palestra (codigo_atividade, descricao, publico_alvo) VALUES (39, "Dados no mundo corporativo", "Cientistas de Dados");
INSERT INTO palestra (codigo_atividade, descricao, publico_alvo) VALUES (40, "Visão na Computação", "Computação");
/* Inserção Parte 3 */
/* Inserção Dados Participante - Ouvinte e Palestrante */
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Kleberson Gonçalves", 43269456701, 34504231, "kleberson@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490931, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Adelia Silva", 43269456702, 34504232, "adelia@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490932, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Matheus Felix", 43269456703, 34504233, "matheus@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490933, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Dayane Silva", 43269456704, 34504234, "dayane@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490934, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Ricardo Pereira", 43269456705, 34504235, "Ricardo@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490935, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Bianca Dias", 62207591338, 01014001, "biancadias@usp.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 996324472, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Helena Matsuda", 35712439866, 01015001, "hmatsuda@usp.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 981650032, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Luciana Karmizec", 39720465821, 01679001, "karmizec@usp.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 945459966, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Fernando Alburqueque", 29169407291, 01027001, "fernando.alburqueque@usp.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 997246684, false, true, true, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Fagner Pereira", 43269456725, 34504255, "fagner@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490955, false, true, false, false, true, false, false, false);
/* Inserção Dados Palestrante */
INSERT INTO palestrante (cpf, filiacao, minicurriculo) VALUES (43269456701, "DEFREX", "minicurriculo.pdf");
INSERT INTO palestrante (cpf, filiacao, minicurriculo) VALUES (43269456702, "FLY", "minicurriculo.pdf");
INSERT INTO palestrante (cpf, filiacao, minicurriculo) VALUES (43269456703, "FREG", "minicurriculo.pdf");
INSERT INTO palestrante (cpf, filiacao, minicurriculo) VALUES (43269456704, "XIAM", "minicurriculo.pdf");
INSERT INTO palestrante (cpf, filiacao, minicurriculo) VALUES (43269456705, "AMAZIN", "minicurriculo.pdf");
INSERT INTO palestrante (cpf, filiacao, minicurriculo) VALUES (43269456725, "AMUZIN", "minicurriculo.pdf");
/* Inserção Dados Participante - Ouvinte e Instrutor */
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Kleber Silva", 43269456706, 34504236, "kleber@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490936, false, false, true, false, false, true, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Marjure Gonçalves", 43269456707, 34504237, "marjure@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490937, false, false, true, false, false, true, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("André Felix", 43269456708, 34504238, "andre@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490938, false, false, true, false, false, true, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Victoria Silva", 43269456709, 34504239, "victoria@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490939, false, false, true, false, false, true, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Reginaldo Pereira", 43269456710, 34504240, "Reginaldo@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490940, false, false, true, false, false, true, false, false);
/* Inserção Dados Instrutor */
INSERT INTO instrutor (cpf) VALUES (43269456706);
INSERT INTO instrutor (cpf) VALUES (43269456707);
INSERT INTO instrutor (cpf) VALUES (43269456708);
INSERT INTO instrutor (cpf) VALUES (43269456709);
INSERT INTO instrutor (cpf) VALUES (43269456710);
/* Inserção Dados Participante - Staff */
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Amanda Silva", 43269456711, 34504241, "amanda@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490941, true, false, false, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Adriana Gonçalves", 43269456712, 34504242, "adriana@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490942, true, false, false, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Bianca Felix", 43269456713, 34504243, "bianca@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490943, true, false, false, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Barbara Silva", 43269456714, 34504244, "barbara@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490944, true, false, false, false, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Bruna Pereira", 43269456715, 34504245, "bruna@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490945, true, false, false, false, false, false, false, false);
/* Inserção Dados Staff */
INSERT INTO staff (cpf) VALUES (43269456711);
INSERT INTO staff (cpf) VALUES (43269456712);
INSERT INTO staff (cpf) VALUES (43269456713);
INSERT INTO staff (cpf) VALUES (43269456714);
INSERT INTO staff (cpf) VALUES (43269456715);
/* Inserção Dados Participante - Organizador */
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Carol Silva", 43269456716, 34504246, "carol@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490946, false, false, false, true, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Eduardo Gonçalves", 43269456717, 34504247, "eduardo@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490947, false, false, false, true, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Eduarda Felix", 43269456718, 34504248, "eduarda@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490948, false, false, false, true, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Edmundo Silva", 43269456719, 34504249, "edmundo@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490949, false, false, false, true, false, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Felipe Pereira", 43269456720, 34504250, "felipe@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490950, false, false, false, true, false, false, false, false);
/* Inserção Dados Participante - Ministrante_tutoria */
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Felix Silva", 43269456721, 34504251, "felix@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490951, false, false, false, false, true, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Fernando Gonçalves", 43269456722, 34504252, "fernando@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490952, false, false, false, false, true, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Fernanda Felix", 43269456723, 34504253, "fernanda@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490953, false, false, false, false, true, false, false, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Fátima Silva", 43269456724, 34504254, "fátima@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490954, false, false, false, false, true, false, false, false);
/* Inserção Dados Ministrante_Tutoria */
INSERT INTO ministrante_tutoria (cpf, afiliacao, minicurriculo) VALUES (43269456721, "DEFREX", "minicurriculo.pdf");
INSERT INTO ministrante_tutoria (cpf, afiliacao, minicurriculo) VALUES (43269456722, "LOTHOZ", "minicurriculo.pdf");
INSERT INTO ministrante_tutoria (cpf, afiliacao, minicurriculo) VALUES (43269456723, "DANFREX", "minicurriculo.pdf");
INSERT INTO ministrante_tutoria (cpf, afiliacao, minicurriculo) VALUES (43269456724, "FETIZ", "minicurriculo.pdf");
INSERT INTO ministrante_tutoria (cpf, afiliacao, minicurriculo) VALUES (43269456725, "XIETEX", "minicurriculo.pdf");
INSERT INTO ministrante_tutoria (cpf, afiliacao, minicurriculo) VALUES (43269456705, "XIITEX", "minicurriculo.pdf");
UPDATE participante SET Ministrante_tutoria = 1 WHERE (cpf = 43269456705);
/* Inserção Dados Participante - avaliador */
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Gabriel Silva", 43269456726, 34504256, "gabriel@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490956, false, false, false, false, false, false, true, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Gabriela Gonçalves", 43269456727, 34504257, "gabriela@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490957, false, false, false, false, false, false, true, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Gustavo Felix", 43269456728, 34504258, "gustavo@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490958, false, false, false, false, false, false, true, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Giovanna Silva", 43269456729, 34504259, "giovanna@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490959, false, false, false, false, false, false, true, false);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Giovanne Pereira", 43269456730, 34504260, "giovanne@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490960, false, false, false, false, false, false, true, false);
/* Inserção Avaliador */
INSERT INTO avaliador (cpf) VALUES (43269456726);
INSERT INTO avaliador (cpf) VALUES (43269456727);
INSERT INTO avaliador (cpf) VALUES (43269456728);
INSERT INTO avaliador (cpf) VALUES (43269456729);
INSERT INTO avaliador (cpf) VALUES (43269456730);
/* Inserção Dados Participante - Ouvinte e Autor_Artigo */
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Hannah Silva", 43269456731, 34504261, "hannah@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490961, false, false, true, false, false, false, false, true);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Helise Gonçalves", 43269456732, 34504262, "helise@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490962, false, false, true, false, false, false, false, true);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Heliana Felix", 43269456733, 34504263, "heliana@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490963, false, false, true, false, false, false, false, true);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Helio Silva", 43269456734, 34504264, "helio@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490964, false, false, true, false, false, false, false, true);
INSERT INTO participante (nome, cpf, cep, e_mail, senha, telefone, Staff, Palestrante, Ouvinte, Organizador, Ministrante_tutoria, Instrutor, Avaliador, Autor_Artigo)
VALUES ("Ian Pereira", 43269456735, 34504265, "ian@contato.com", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", 458490965, false, false, true, false, false, false, false, true);
/* Inserção Dados Autor_Artigo */
INSERT INTO autor_artigo (cpf, minicurriculo) VALUES (43269456731, "minicurriculo.pdf");
INSERT INTO autor_artigo (cpf, minicurriculo) VALUES (43269456732, "minicurriculo.pdf");
INSERT INTO autor_artigo (cpf, minicurriculo) VALUES (43269456733, "minicurriculo.pdf");
INSERT INTO autor_artigo (cpf, minicurriculo) VALUES (43269456734, "minicurriculo.pdf");
INSERT INTO autor_artigo (cpf, minicurriculo) VALUES (43269456735, "minicurriculo.pdf");
/* Inserção Dados Ouvinte */
INSERT INTO ouvinte (cpf) VALUES (43269456701);
INSERT INTO ouvinte (cpf) VALUES (43269456702);
INSERT INTO ouvinte (cpf) VALUES (43269456703);
INSERT INTO ouvinte (cpf) VALUES (43269456704);
INSERT INTO ouvinte (cpf) VALUES (43269456705);
INSERT INTO ouvinte (cpf) VALUES (43269456706);
INSERT INTO ouvinte (cpf) VALUES (43269456707);
INSERT INTO ouvinte (cpf) VALUES (43269456708);
INSERT INTO ouvinte (cpf) VALUES (43269456709);
INSERT INTO ouvinte (cpf) VALUES (43269456710);
INSERT INTO ouvinte (cpf) VALUES (43269456731);
INSERT INTO ouvinte (cpf) VALUES (43269456732);
INSERT INTO ouvinte (cpf) VALUES (43269456733);
INSERT INTO ouvinte (cpf) VALUES (43269456734);
INSERT INTO ouvinte (cpf) VALUES (43269456735);
/* Inserção Dados Inscreve (Relação N-N entre Ouvinte e Atividade) */
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (1 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (2 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (3 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (4 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (5 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (6 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (8 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (9 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (10 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (11 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (12 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (13 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (14 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (15 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (16 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (17 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (18 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (19 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (20 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (21 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (22 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (23 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (24 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (25 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (26 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (28 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (29 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (31 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (32 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (34 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (35 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (36 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (37 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (38 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (1 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (2 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (3 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (4 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (5 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (6 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (8 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (9 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (10 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (11 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (12 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (13 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (14 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (15 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (16 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (17 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (18 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (19 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (20 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (21 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (22 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (23 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (24 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (25 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (26 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (28 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (29 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (31 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (32 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (34 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (35 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (36 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (37 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (38 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (1 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (2 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (3 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (4 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (5 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (6 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (8 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (9 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (10 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (11 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (12 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (13 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (14 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (15 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (16 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (17 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (18 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (19 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (20 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (21 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (22 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (23 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (24 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (25 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (26 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (28 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (29 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (31 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (32 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (34 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (35 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (36 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (37 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (38 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (9 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (10 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (11 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (20 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (22 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (32 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456701);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (22 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (25 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (32 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456702);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (25 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456703);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (10 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (11 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456704);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (2 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (10 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (23 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (28 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456705);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (10 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (35 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456706);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (1 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (20 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456707);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (1 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (29 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456708);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (11 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (20 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (22 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (34 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (36 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (37 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456709);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (1 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (10 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (31 , 43269456710);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (11 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (21 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456731);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (19 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (29 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456732);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (1 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (28 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456733);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (1 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (22 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (33 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (39 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (40 , 43269456734);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (7 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (27 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (29 , 43269456735);
INSERT INTO inscreve (codigo_atividade, cpf) VALUES (30 , 43269456735);
/* Inserção Dados Organiza (Relação entre Staff e Atividade) */
INSERT INTO organiza (codigo_atividade, cpf) VALUES (1 , 43269456711);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (2 , 43269456711);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (3 , 43269456711);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (4 , 43269456711);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (5 , 43269456711);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (6 , 43269456711);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (7 , 43269456711);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (8 , 43269456711);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (9 , 43269456712);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (10 , 43269456712);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (11 , 43269456712);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (12 , 43269456712);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (13 , 43269456712);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (14 , 43269456712);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (15 , 43269456712);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (16 , 43269456712);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (17 , 43269456713);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (18 , 43269456713);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (19 , 43269456713);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (20 , 43269456713);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (21 , 43269456713);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (22 , 43269456713);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (23 , 43269456713);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (24 , 43269456713);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (25 , 43269456714);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (26 , 43269456714);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (27 , 43269456714);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (28 , 43269456714);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (29 , 43269456714);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (30 , 43269456714);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (31 , 43269456714);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (32 , 43269456714);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (33 , 43269456715);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (34 , 43269456715);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (35 , 43269456715);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (36 , 43269456715);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (37 , 43269456715);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (38 , 43269456715);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (39 , 43269456715);
INSERT INTO organiza (codigo_atividade, cpf) VALUES (40 , 43269456715);
/* Inserção Dados Apresenta (Relação entre Palestrante e Palestra) */
INSERT INTO apresenta (codigo_atividade, cpf) VALUES (36 , 43269456701);
INSERT INTO apresenta (codigo_atividade, cpf) VALUES (37 , 43269456702);
INSERT INTO apresenta (codigo_atividade, cpf) VALUES (38 , 43269456703);
INSERT INTO apresenta (codigo_atividade, cpf) VALUES (39 , 43269456704);
INSERT INTO apresenta (codigo_atividade, cpf) VALUES (40 , 43269456705);
/* Inserção Dados Ministra (Relação entre Ministrante_tutoria e Tutoria) */
INSERT INTO ministra (codigo_atividade, cpf) VALUES (31, 43269456721);
INSERT INTO ministra (codigo_atividade, cpf) VALUES (32, 43269456722);
INSERT INTO ministra (codigo_atividade, cpf) VALUES (33, 43269456723);
INSERT INTO ministra (codigo_atividade, cpf) VALUES (34, 43269456724);
INSERT INTO ministra (codigo_atividade, cpf) VALUES (35, 43269456725);
/* Inserção Dados Conduz (Relação entre instrutor e workshop) */
INSERT INTO conduz (codigo_atividade, cpf) VALUES (21, 43269456706);
INSERT INTO conduz (codigo_atividade, cpf) VALUES (22, 43269456707);
INSERT INTO conduz (codigo_atividade, cpf) VALUES (23, 43269456708);
INSERT INTO conduz (codigo_atividade, cpf) VALUES (24, 43269456709);
INSERT INTO conduz (codigo_atividade, cpf) VALUES (25, 43269456710);
/* Inserção Dados Julga (Relação entre avaliador e concurso) */
INSERT INTO julga (codigo_atividade, cpf) VALUES (26, 43269456726);
INSERT INTO julga (codigo_atividade, cpf) VALUES (27, 43269456727);
INSERT INTO julga (codigo_atividade, cpf) VALUES (28, 43269456728);
INSERT INTO julga (codigo_atividade, cpf) VALUES (29, 43269456729);
INSERT INTO julga (codigo_atividade, cpf) VALUES (30, 43269456730);
/* Inserção Dados Publica (Relação entre Autor_artigo e artigo) */
INSERT INTO publica (cpf, DOI) VALUES (43269456731, "94RHFJFJKCO");
INSERT INTO publica (cpf, DOI) VALUES (43269456732, "BDHFI3750RJM");
INSERT INTO publica (cpf, DOI) VALUES (43269456733, "D55235CBANC");
INSERT INTO publica (cpf, DOI) VALUES (43269456734, "H3546DKVHSJDO");
INSERT INTO publica (cpf, DOI) VALUES (43269456735, "OE974YBNOAQOP");
/* Inserção Parte 4 */
/*Certificado*/
INSERT INTO certificado(numero_certificado, titulo, cpf, descricao, carga_horaria, data_emissao, cnpj) VALUES (12345677, 'Certificado de Participação', 43269456701, 'Certificado que prova a particação no evento "CONBRAN 2020 - XXVI Congresso Brasileiro de Nutrição"', 6 , '2021-01-22', 11524184000187);
INSERT INTO certificado(numero_certificado, titulo, cpf, descricao, carga_horaria, data_emissao, cnpj) VALUES (12345678, 'Certificado de Participação', 43269456702, 'Certificado que prova a particação no evento "XL Congresso da Sociedade Brasileira de Computação"', 6 , '2020-11-20', 11524184000187);
INSERT INTO certificado(numero_certificado, titulo, cpf, descricao, carga_horaria, data_emissao, cnpj) VALUES (01234567, 'Certificado de Participação', 43269456703, 'Certificado que prova a particação no evento "CONBCON - Congresso Online Brasileiro de Contabilidade"', 6 , '2020-09-25', 11524184000187);
INSERT INTO certificado(numero_certificado, titulo, cpf, descricao, carga_horaria, data_emissao, cnpj) VALUES (23456781, 'Certificado de Participação', 43269456704, 'Certificado que prova a particação no evento "XXXIV Congresso Brasileiro de Direito Administrativo"', 6 , '2020-11-07', 11524184000187);
INSERT INTO certificado(numero_certificado, titulo, cpf, descricao, carga_horaria, data_emissao, cnpj) VALUES (51535545, 'Certificado de Participação', 43269456705, 'Certificado que prova a particação no evento "XVIII Congresso Brasileiro do Sono"', 6 , '2021-06-05', 11524184000187);
/*Tipo Participante*/
INSERT INTO tipo_participante(numero_certificado, tipo_participante) VALUES (12345677, 'ouvinte');
INSERT INTO tipo_participante(numero_certificado, tipo_participante) VALUES (12345678, 'ouvinte');
INSERT INTO tipo_participante(numero_certificado, tipo_participante) VALUES (01234567, 'ouvinte');
INSERT INTO tipo_participante(numero_certificado, tipo_participante) VALUES (23456781, 'ouvinte');
INSERT INTO tipo_participante(numero_certificado, tipo_participante) VALUES (51535545, 'ouvinte');
/*Lote e Ingresso*/
INSERT INTO lote(numero_lote, valor) VALUES(1,50);
INSERT INTO lote(numero_lote, valor) VALUES(2,60);
INSERT INTO lote(numero_lote, valor) VALUES(3,70);
INSERT INTO lote(numero_lote, valor) VALUES(4,80);
INSERT INTO lote(numero_lote, valor) VALUES(5,90);
INSERT INTO ingresso(numero_ingresso, numero_lote,data,desconto,forma_pagamento, cpf, id_evento) VALUES(11,1,'2021-01-19','50','dinheiro',43269456701,1);
INSERT INTO ingresso(numero_ingresso, numero_lote,data,desconto,forma_pagamento, cpf, id_evento) VALUES(22,2,'2020-11-16','40','dinheiro',43269456702,2);
INSERT INTO ingresso(numero_ingresso, numero_lote,data,desconto,forma_pagamento, cpf, id_evento) VALUES(33,3,'2020-09-21','30','boleto',43269456703,3);
INSERT INTO ingresso(numero_ingresso, numero_lote,data,desconto,forma_pagamento, cpf, id_evento) VALUES(44,4,'2020-11-04','20','cartão',43269456704,4);
INSERT INTO ingresso(numero_ingresso, numero_lote,data,desconto,forma_pagamento, cpf, id_evento) VALUES(55,5,'2021-06-03','10','dinheiro',43269456705,5);
/*Representante e Representa*/
INSERT INTO representante(cpf_representante, nome, email, telefone) VALUES(53269456701, "Zinedine Zidane", 'zidane@contato.com', 12345678);
INSERT INTO representante(cpf_representante, nome, email, telefone) VALUES(53269456702, "Lionel Messi", 'messi@contato.com', 12345677);
INSERT INTO representante(cpf_representante, nome, email, telefone) VALUES(53269456703, "Cristiano Ronaldo", 'cr07@contato.com', 12345676);
INSERT INTO representante(cpf_representante, nome, email, telefone) VALUES(53269456704, "Ronaldo Nazario", 'ronaldo09@contato.com', 12345675);
INSERT INTO representante(cpf_representante, nome, email, telefone) VALUES(53269456705, "Diego Armando Maradona", 'maradona_rei_delas@contato.com', 12345674);
INSERT INTO representa(cnpj, cpf_representante) VALUES (11524184000187, 53269456701);
INSERT INTO representa(cnpj, cpf_representante) VALUES (29532264000178, 53269456702);
INSERT INTO representa(cnpj, cpf_representante) VALUES (14578574000156, 53269456703);
INSERT INTO representa(cnpj, cpf_representante) VALUES (27349772000111, 53269456704);
INSERT INTO representa(cnpj, cpf_representante) VALUES (07755256000158, 53269456705);
/*Patrocinadora e Patrocina*/
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora) VALUES (17359434000511, "Avenida Paulista", "São Paulo", "São Paulo", "01310-940", "900", "Pneus S.A", "pneus@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, true, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora) VALUES (22259434000333, "Avenida Brigadeiro Faria Lima", "São Paulo", "São Paulo", "05426-200", "1000", "Planos de Saude S.A", "saude@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, true, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora) VALUES (12359434000321, "Avenida Pompéia", "São Paulo", "São Paulo", "05022-000", "1030", "Tecnologia e Segurança Privada S.A", "tecseguranca@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, true, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora) VALUES (55559434000432, "Avenida Alcântara Machado", "São Paulo", "São Paulo", "03302-000", "3456", "Elétrica Segurança", "eletricsecurity@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, true, false);
INSERT INTO entidade (cnpj, end_logradouro, end_cidade, end_estado, end_cep, end_numero, nome_entidade, email, senha, Promotora, Patrocinadora, Organizadora) VALUES (25559434000522, "Avenida Assis Ribeiro", "São Paulo", "São Paulo", "03717-002", "1600", "Carreta Furacão Siga em Frente", "carretaEventos@contato.br", "$2b$10$TM0wdHsCY4xZIe1BH/Jp0uny9Kr7Sv461myqmcaalJY8CEi0XOg.i", false, true, false);
INSERT INTO patrocinadora(cnpj) VALUES (17359434000511);
INSERT INTO patrocinadora(cnpj) VALUES (22259434000333);
INSERT INTO patrocinadora(cnpj) VALUES (12359434000321);
INSERT INTO patrocinadora(cnpj) VALUES (55559434000432);
INSERT INTO patrocinadora(cnpj) VALUES (25559434000522);
INSERT INTO patrocina(cnpj, id_evento) VALUES (17359434000511,1);
INSERT INTO patrocina(cnpj, id_evento) VALUES (22259434000333,2);
INSERT INTO patrocina(cnpj, id_evento) VALUES (12359434000321,3);
INSERT INTO patrocina(cnpj, id_evento) VALUES (55559434000432,4);
INSERT INTO patrocina(cnpj, id_evento) VALUES (25559434000522,5);
INSERT INTO PATROCINA (cnpj, id_evento) VALUES
(12359434000321, 6),
(17359434000511, 6),
(22259434000333, 6),
(25559434000522, 6),
(55559434000432, 6),
(22259434000333, 7),
(25559434000522, 7),
(55559434000432, 7),
(12359434000321, 7),
(25559434000522, 8),
(25559434000522, 9),
(22259434000333, 8),
(55559434000432, 9),
(55559434000432, 10);
/*Contrato e Rede Social*/
INSERT INTO contrato(id_contrato, representante_evento, representante_patrocinadora, taxa_patrocinio, plano_patrocinio, data_inicio, data_fim, cnpj, C_O_cnpj)
VALUES (1,"Edson Arantes do Nascimento", "Zinedine Zidane", 30, 'Basico', '2021-01-19', '2021-01-22', 17359434000511,11524184000187);
INSERT INTO contrato(id_contrato, representante_evento, representante_patrocinadora, taxa_patrocinio, plano_patrocinio, data_inicio, data_fim, cnpj, C_O_cnpj)
VALUES (2,"Luis Figo", "Lionel Messi", 20, 'Bronze', '2020-11-16', '2020-11-20', 22259434000333, 29532264000178);
INSERT INTO contrato(id_contrato, representante_evento, representante_patrocinadora, taxa_patrocinio, plano_patrocinio, data_inicio, data_fim, cnpj, C_O_cnpj)
VALUES (3,"Paolo Maldini", "Cristiano Ronaldo", 20, 'Bronze', '2020-09-21', '2020-09-25', 12359434000321,14578574000156);
INSERT INTO contrato(id_contrato, representante_evento, representante_patrocinadora, taxa_patrocinio, plano_patrocinio, data_inicio, data_fim, cnpj, C_O_cnpj)
VALUES (4,"Thierry Henry", "Ronaldo Nazario", 10, 'Prata', '2020-11-04', '2020-11-07', 55559434000432, 27349772000111);
INSERT INTO contrato(id_contrato, representante_evento, representante_patrocinadora, taxa_patrocinio, plano_patrocinio, data_inicio, data_fim, cnpj, C_O_cnpj)
VALUES (5,"Claude Makélélée", "Diego Armando Maradona", 0, 'Gold', '2021-06-03', '2021-06-05', 25559434000522, 07755256000158);
INSERT INTO rede_social(nome, url, usuario, id_evento,cnpj) VALUES ('facebook','https://www.facebook.com', 'Evento Ultra Mega Show', 1, 37159434000115);
INSERT INTO rede_social(nome, url, usuario, id_evento,cnpj) VALUES ('youtube','https://www.youtube.com', 'Evento Ultra Mega Show', 2, 37159434000115);
INSERT INTO rede_social(nome, url, usuario, id_evento,cnpj) VALUES ('instagram','https://www.instagram.com', 'Evento Ultra Mega Show', 3, 37159434000115);
INSERT INTO rede_social(nome, url, usuario, id_evento,cnpj) VALUES ('twitter','https://www.twitter.com', 'Evento Ultra Mega Show', 4, 37159434000115);
INSERT INTO rede_social(nome, url, usuario, id_evento,cnpj) VALUES ('LinkedIn','https://br.linkedin.com', 'Evento Ultra Mega Show', 5, 37159434000115);
/* Inserção Parte 5 */
/* Inserção Dados Organizador */
INSERT INTO organizador (cpf, remuneracao, carga_horaria) VALUES
(43269456716, 700.00, 8.00),
(43269456717, 750.00, 8.00),
(43269456718, 730.00, 8.00),
(43269456719, 720.00, 8.00),
(43269456720, 725.00, 8.00);
INSERT INTO organizador (cpf, remuneracao, carga_horaria) VALUES
(43269456731, 720.00, 8.00),
(43269456733, 720.00, 8.00),
(43269456734, 720.00, 8.00);
UPDATE participante
set organizador = 1
where cpf IN (43269456730, 43269456731, 43269456733, 43269456734);
/*Contrata: relacao entre Organizadora e organizador*/
INSERT INTO contrata (cpf, data_inicio, data_fim, cnpj) VALUES
(43269456716, '2021-01-19', '2022-01-22',11524184000187),
(43269456717, '2020-11-16', '2022-11-20',11524184000187),
(43269456718, '2020-09-21', '2021-03-25',11524184000187),
(43269456719, '2020-11-04', '2021-04-07',11524184000187),
(43269456720, '2021-06-03', '2022-04-05',11524184000187),
(43269456731, '2020-08-01', '2021-06-15',11524184000187),
(43269456733, '2021-01-22', '2021-06-09',11524184000187),
(43269456734, '2021-03-14', '2021-07-11',11524184000187);
/*Compoe: relacao entre Organizador e Comite_programa*/
INSERT INTO compoe (id_comite, cpf) VALUES
(1,43269456716),
(2,43269456716),
(3,43269456717),
(4,43269456720),
(5,43269456719),
(5,43269456718);
/* Local origem das caravanas*/
INSERT INTO local_origem (Id_local, Logradouro, Cidade, Estado, CEP, Numero) VALUES
(1,'Rua do Flamingo', 'Fernandopolis', 'SP', 15600000, 156),
(2,'Avenida guga', 'Fernando de Noronha', 'RJ', 15420000, 245),
(3,'Rua do santinho', 'Montes Claros', 'MG', 12765000, 27),
(4,'Rua do Poze do rodo', 'Favela do Rodo', 'RJ', 98456000, 144),
(5,'Avenida ave nida', 'Criciúma', 'SC', 38415020, 755);
/*caravana*/
INSERT INTO Caravana (Nome_caravana, Data_saida, Data_chegada, Id_local) VALUES
('caravana fernandopolis', '2020-11-16', '2020-11-18', 1),
('caravana do rodo', '2020-11-15', '2020-11-17', 2),
('santavana', '2020-11-17','2020-11-18', 3),
('carnavana', '2020-11-12','2020-11-15', 4),
('caranida', '2020-11-13','2020-11-19',5);
INSERT INTO participante_caravana (cpf, Valor_passagem, Nome_caravana) VALUES
(43269456725, 350.45, 'caravana do rodo'),
(43269456728, 382.30, 'caranida'),
(43269456721, 382.30, 'caranida'),
(43269456735, 230.25, 'caravana fernandopolis'),
(43269456711, 230.25, 'caravana fernandopolis'),
(43269456708, 110.70, 'carnavana'),
(43269456713, 270.65, 'santavana');
INSERT INTO Canal_informativo (Id_canal, Nome, URL, Nome_caravana) VALUES
(1, 'LinkedIn', 'linkedin.com/in/carnavana', 'carnavana'),
(2, 'Facebook', 'facebook.com/carnavana', 'carnavana'),
(3, 'LinkedIn', 'linkedin.com/in/caranida', 'caranida'),
(4, 'Facebook', 'facebook.com/caravana_fernandopolis', 'caravana fernandopolis'),
(5, 'Facebook', 'facebook.com/caravana-do-rodo', 'caravana do rodo'),
(6, 'Instagram', 'instagram.com/caravanadorodo', 'caravana do rodo'),
(7, 'Instagram', 'instagram.com/caravanadorodo', 'santavana');
INSERT INTO Divulga (Id_canal, cpf) VALUES
(1,43269456716),
(2,43269456720),
(3,43269456717),
(4,43269456716),
(5,43269456718),
(4,43269456719);
INSERT INTO mobilizador_caravana (CPF, Nome, Telefone, CEP, Nome_caravana, cnpj, COO_CPF, Id_canal) VALUES
(43269456736, 'Daniel Orivaldo da Silva', 1192345678, 51216531, 'caravana do rodo', 7755256000158, 43269456716, 1),
(43269456737, 'Carlos alberto de Nóbrega', 1192345768, 51216443, 'carnavana', 7755256000158, 43269456718, 5),
(43269456738, 'Ednaldo Pereira', 1192543608, 33416581, 'caravana fernandopolis', 7755256000158, 43269456720, 3),
(43269456739, 'Tristão alenídio Soares', 1193354698, 78516441, 'santavana', 7755256000158, 43269456719, 4),
(43269456740, 'Uzumaki Naruto', 1192445798, 85216531, 'caranida', 7755256000158, 43269456716, 2),
(43269456741, 'João das Couves', 1199741238, 51216531, 'caravana do rodo', 7755256000158, 43269456717, 1);
INSERT INTO veiculo (Tipo, Valor_passagem, Nome_companhia, Nome_caravana) VALUES
('Ônibus', 350.45, 'Gontijo', 'caravana do rodo'),
('Van', 110.7, 'Vanzaum do pedro', 'carnavana'),
('Ônibus', 382.3, 'bujão', 'caranida'),
('Avião', 230.25, 'AirBNB', 'caravana fernandopolis'),
('van', 270.65, 'Van gogh', 'santavana');
|
-- phpMyAdmin SQL Dump
-- version 4.9.1
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 22-01-2020 a las 19:21:40
-- Versión del servidor: 10.4.8-MariaDB
-- Versión de PHP: 7.1.33
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 */;
--
-- Base de datos: `dbventaslarabel`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `articulo`
--
CREATE TABLE `articulo` (
`idArticulo` int(11) NOT NULL,
`idCategoria` int(11) NOT NULL,
`Codigo` varchar(50) DEFAULT NULL,
`Nombre` varchar(100) NOT NULL,
`Stock` int(11) NOT NULL,
`Descripcion` varchar(512) DEFAULT NULL,
`Imagen` varchar(50) DEFAULT NULL,
`Estado` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `articulo`
--
INSERT INTO `articulo` (`idArticulo`, `idCategoria`, `Codigo`, `Nombre`, `Stock`, `Descripcion`, `Imagen`, `Estado`) VALUES
(1, 1, '0001', 'Impresora Epson', 10, NULL, 'impresora.jpg', 'Inactivo'),
(2, 1, '0002', 'Impresora Epson', 15, 'impresora', 'impre.jpg', 'Activo');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `categoria`
--
CREATE TABLE `categoria` (
`idCategoria` int(11) NOT NULL,
`Nombre` varchar(50) NOT NULL,
`Descripcion` varchar(256) DEFAULT NULL,
`Condicion` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `categoria`
--
INSERT INTO `categoria` (`idCategoria`, `Nombre`, `Descripcion`, `Condicion`) VALUES
(1, 'Equipos de Cómputo', 'Accesorios de cómputo', 1),
(2, 'Limpieza', 'Artículos de limpieza', 1),
(3, 'Comestible', 'Artículos comestibles', 1),
(4, 'Líquidos', 'Productos líquidos', 1),
(5, 'Perfumería', 'Artículos de perfumería ', 1),
(6, 'Bazar', 'Artículos de bazar', 1),
(7, 'Lácteos', 'Productos lácteos', 1),
(8, 'Golosinas', 'Artículos de golosinas', 1),
(9, 'Juguetes', 'Accesorios de juguetes', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `detalle_ingreso`
--
CREATE TABLE `detalle_ingreso` (
`idDetalle_ingreso` int(11) NOT NULL,
`idIngreso` int(11) NOT NULL,
`idArticulo` int(11) NOT NULL,
`Cantidad` int(11) NOT NULL,
`Precio_compra` decimal(11,2) NOT NULL,
`Precio_venta` decimal(11,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `detalle_venta`
--
CREATE TABLE `detalle_venta` (
`idDetalle_venta` int(11) NOT NULL,
`idVenta` int(11) NOT NULL,
`idArticulo` int(11) NOT NULL,
`Cantidad` int(11) NOT NULL,
`Precio_venta` decimal(11,2) NOT NULL,
`Descuento` decimal(11,2) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ingreso`
--
CREATE TABLE `ingreso` (
`idIngreso` int(11) NOT NULL,
`idProveedor` int(11) NOT NULL,
`Tipo_comprobante` varchar(20) NOT NULL,
`Serie_comprobante` varchar(7) DEFAULT NULL,
`Num_comprobante` varchar(10) NOT NULL,
`Fecha_hora` datetime NOT NULL,
`Impuesto` decimal(4,2) NOT NULL,
`Estado` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `ingreso`
--
INSERT INTO `ingreso` (`idIngreso`, `idProveedor`, `Tipo_comprobante`, `Serie_comprobante`, `Num_comprobante`, `Fecha_hora`, `Impuesto`, `Estado`) VALUES
(1, 4, 'Boleta', '007', '0008', '2016-01-23 21:00:08', '18.00', 'A'),
(2, 4, 'Boleta', '004', '00010', '2014-10-05 07:38:22', '18.00', 'A'),
(3, 4, 'Boleta', '001', '0005', '2019-01-28 10:18:54', '18.00', 'A'),
(4, 4, 'Boleta', '006', '0001', '2016-11-18 09:32:17', '18.00', 'A'),
(5, 4, 'Boleta', '002', '0007', '2011-04-10 12:37:47', '18.00', 'A'),
(6, 4, 'Boleta', '003', '0001', '2015-02-25 08:35:20', '18.00', 'A'),
(7, 4, 'Boleta', '001', '0001', '2010-05-31 12:10:33', '18.00', 'A'),
(8, 4, 'Factura', '001', '0001', '2010-06-24 09:36:00', '18.00', 'A');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `persona`
--
CREATE TABLE `persona` (
`idPersona` int(11) NOT NULL,
`Tipo_persona` varchar(20) NOT NULL,
`Nombre` varchar(100) NOT NULL,
`Tipo_documento` varchar(20) DEFAULT NULL,
`Num_documento` varchar(15) DEFAULT NULL,
`Direccion` varchar(70) DEFAULT NULL,
`Telefono` varchar(15) DEFAULT NULL,
`Email` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `persona`
--
INSERT INTO `persona` (`idPersona`, `Tipo_persona`, `Nombre`, `Tipo_documento`, `Num_documento`, `Direccion`, `Telefono`, `Email`) VALUES
(1, 'Cliente', 'Paula Robles', 'DNI', '24551002', 'Las Heras 222', '03865-421563', 'pr90@gmail.com'),
(2, 'Cliente', 'Jorge Contreras', 'DNI', '33754187', 'Suipacha 1054', '03865-745895', 'jorgecont@gmail.com'),
(3, 'Cliente', 'Lautaro Soria', 'PAS', '34120415', 'San Martín 2014', NULL, NULL),
(4, 'Proveedor', 'Soluciones Innovadoras S.A', 'DNI', '44561234', 'Laprida 105', '01147112466', 'solucionesin@gmail.com'),
(5, 'Inactivo', 'Insumos Informático S.A', 'DOC', '24000458', 'Juangorena 1000', '03657588454', 'insumos3@gmail.com');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `venta`
--
CREATE TABLE `venta` (
`idVenta` int(11) NOT NULL,
`idCliente` int(11) NOT NULL,
`Tipo_comprobante` varchar(20) NOT NULL,
`Serie_comprobante` varchar(7) NOT NULL,
`Num_comprobante` varchar(10) NOT NULL,
`Fecha_hora` datetime NOT NULL,
`Impuesto` decimal(4,2) NOT NULL,
`Total_venta` decimal(11,2) NOT NULL,
`Estado` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `articulo`
--
ALTER TABLE `articulo`
ADD PRIMARY KEY (`idArticulo`),
ADD KEY `fk_articulo_categoria_idx` (`idCategoria`);
--
-- Indices de la tabla `categoria`
--
ALTER TABLE `categoria`
ADD PRIMARY KEY (`idCategoria`);
--
-- Indices de la tabla `detalle_ingreso`
--
ALTER TABLE `detalle_ingreso`
ADD PRIMARY KEY (`idDetalle_ingreso`),
ADD KEY `fk_detalle_ingreso_idx` (`idIngreso`),
ADD KEY `fk_detalle_ingreso_articulo_idx` (`idArticulo`);
--
-- Indices de la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
ADD PRIMARY KEY (`idDetalle_venta`),
ADD KEY `fk_detalle_venta_articulo_idx` (`idArticulo`),
ADD KEY `fk_detalle_venta_idx` (`idVenta`);
--
-- Indices de la tabla `ingreso`
--
ALTER TABLE `ingreso`
ADD PRIMARY KEY (`idIngreso`),
ADD KEY `fk_ingreso_persona_idx` (`idProveedor`);
--
-- Indices de la tabla `persona`
--
ALTER TABLE `persona`
ADD PRIMARY KEY (`idPersona`);
--
-- Indices de la tabla `venta`
--
ALTER TABLE `venta`
ADD PRIMARY KEY (`idVenta`),
ADD KEY `fk_venta_cliente_idx` (`idCliente`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `articulo`
--
ALTER TABLE `articulo`
MODIFY `idArticulo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `categoria`
--
ALTER TABLE `categoria`
MODIFY `idCategoria` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT de la tabla `detalle_ingreso`
--
ALTER TABLE `detalle_ingreso`
MODIFY `idDetalle_ingreso` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
MODIFY `idDetalle_venta` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `ingreso`
--
ALTER TABLE `ingreso`
MODIFY `idIngreso` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT de la tabla `persona`
--
ALTER TABLE `persona`
MODIFY `idPersona` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `venta`
--
ALTER TABLE `venta`
MODIFY `idVenta` int(11) NOT NULL AUTO_INCREMENT;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `articulo`
--
ALTER TABLE `articulo`
ADD CONSTRAINT `fk_articulo_categoria` FOREIGN KEY (`idCategoria`) REFERENCES `categoria` (`idCategoria`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `detalle_ingreso`
--
ALTER TABLE `detalle_ingreso`
ADD CONSTRAINT `fk_detalle_ingreso` FOREIGN KEY (`idIngreso`) REFERENCES `ingreso` (`idIngreso`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_detalle_ingreso_articulo` FOREIGN KEY (`idArticulo`) REFERENCES `articulo` (`idArticulo`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
ADD CONSTRAINT `fk_detalle_venta` FOREIGN KEY (`idVenta`) REFERENCES `venta` (`idVenta`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_detalle_venta_articulo` FOREIGN KEY (`idArticulo`) REFERENCES `articulo` (`idArticulo`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `ingreso`
--
ALTER TABLE `ingreso`
ADD CONSTRAINT `fk_ingreso_persona` FOREIGN KEY (`idProveedor`) REFERENCES `persona` (`idPersona`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Filtros para la tabla `venta`
--
ALTER TABLE `venta`
ADD CONSTRAINT `fk_venta_cliente` FOREIGN KEY (`idCliente`) REFERENCES `persona` (`idPersona`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;
|
INSERT INTO `towns` (`id`,`name`) VALUES (1,'Sofia');
INSERT INTO `towns` (`id`,`name`) VALUES (2,'Plovdiv');
INSERT INTO `towns` (`id`,`name`) VALUES (3,'Varna');
INSERT INTO `minions` (`id`,`name`,`age`,`town_id`) VALUES (1,'Kevin',22,1);
INSERT INTO `minions` (`id`,`name`,`age`,`town_id`) VALUES (2,'Bob',15,3);
INSERT INTO `minions` (`id`,`name`,`age`,`town_id`) VALUES (3,'Steward',NULL,2);
|
-- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.2.9-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 9.4.0.5125
-- --------------------------------------------------------
/*!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 inventiolite
CREATE DATABASE IF NOT EXISTS `inventiolite` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `inventiolite`;
-- Dumping structure for table inventiolite.box
CREATE TABLE IF NOT EXISTS `box` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.box: ~1 rows (approximately)
/*!40000 ALTER TABLE `box` DISABLE KEYS */;
INSERT INTO `box` (`id`, `created_at`) VALUES
(1, '2017-10-10 21:26:20');
/*!40000 ALTER TABLE `box` ENABLE KEYS */;
-- Dumping structure for table inventiolite.category
CREATE TABLE IF NOT EXISTS `category` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`image` varchar(255) DEFAULT NULL,
`name` varchar(50) NOT NULL,
`description` text DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.category: ~5 rows (approximately)
/*!40000 ALTER TABLE `category` DISABLE KEYS */;
INSERT INTO `category` (`id`, `image`, `name`, `description`, `created_at`) VALUES
(1, NULL, 'Ferreteria', NULL, '2017-10-12 16:06:13'),
(2, NULL, 'Decoracion', NULL, '2017-10-12 16:08:32'),
(3, NULL, 'Cocina', NULL, '2017-10-12 16:08:45'),
(4, NULL, 'Mascotas', NULL, '2017-10-12 16:09:10'),
(5, NULL, 'Muebles ', NULL, '2017-10-12 16:09:36');
/*!40000 ALTER TABLE `category` ENABLE KEYS */;
-- Dumping structure for table inventiolite.configuration
CREATE TABLE IF NOT EXISTS `configuration` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`short` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`kind` int(11) NOT NULL,
`val` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `short` (`short`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.configuration: ~8 rows (approximately)
/*!40000 ALTER TABLE `configuration` DISABLE KEYS */;
INSERT INTO `configuration` (`id`, `short`, `name`, `kind`, `val`) VALUES
(1, 'title', 'Titulo del Sistema', 2, 'Inventio Lite'),
(2, 'use_image_product', 'Utilizar Imagenes en los productos', 1, '0'),
(3, 'active_clients', 'Activar clientes', 1, '0'),
(4, 'active_providers', 'Activar proveedores', 1, '0'),
(5, 'active_categories', 'Activar categorias', 1, '0'),
(6, 'active_reports_word', 'Activar reportes en Word', 1, '0'),
(7, 'active_reports_excel', 'Activar reportes en Excel', 1, '0'),
(8, 'active_reports_pdf', 'Activar reportes en PDF', 1, '0');
/*!40000 ALTER TABLE `configuration` ENABLE KEYS */;
-- Dumping structure for table inventiolite.operation
CREATE TABLE IF NOT EXISTS `operation` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_id` int(11) NOT NULL,
`q` float NOT NULL,
`operation_type_id` int(11) NOT NULL,
`sell_id` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `product_id` (`product_id`),
KEY `operation_type_id` (`operation_type_id`),
KEY `sell_id` (`sell_id`),
CONSTRAINT `operation_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`),
CONSTRAINT `operation_ibfk_2` FOREIGN KEY (`operation_type_id`) REFERENCES `operation_type` (`id`),
CONSTRAINT `operation_ibfk_3` FOREIGN KEY (`sell_id`) REFERENCES `sell` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=82 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.operation: ~76 rows (approximately)
/*!40000 ALTER TABLE `operation` DISABLE KEYS */;
INSERT INTO `operation` (`id`, `product_id`, `q`, `operation_type_id`, `sell_id`, `created_at`) VALUES
(1, 1, 50, 1, NULL, '2017-10-12 16:36:09'),
(2, 24, 100, 1, NULL, '2017-10-12 18:02:02'),
(3, 37, 50, 1, NULL, '2017-10-12 18:34:00'),
(4, 38, 100, 1, NULL, '2017-10-12 18:35:30'),
(5, 39, 200, 1, NULL, '2017-10-12 18:36:57'),
(6, 40, 100, 1, NULL, '2017-10-12 18:38:10'),
(7, 41, 100, 1, NULL, '2017-10-12 18:42:23'),
(8, 2, 85, 1, 1, '2017-10-12 19:52:55'),
(9, 3, 50, 1, 2, '2017-10-12 19:53:13'),
(10, 4, 55, 1, 3, '2017-10-12 19:53:41'),
(11, 5, 30, 1, 4, '2017-10-12 19:55:06'),
(12, 6, 5, 1, 5, '2017-10-12 19:55:28'),
(13, 7, 15, 1, 6, '2017-10-12 19:55:54'),
(14, 8, 35, 1, 7, '2017-10-12 19:56:17'),
(15, 9, 40, 1, 8, '2017-10-12 19:56:32'),
(16, 10, 20, 1, 9, '2017-10-12 19:56:50'),
(17, 11, 20, 1, 10, '2017-10-12 19:57:14'),
(18, 12, 5, 1, 11, '2017-10-12 19:57:33'),
(19, 13, 50, 1, 12, '2017-10-12 19:57:56'),
(20, 14, 150, 1, 13, '2017-10-12 19:58:14'),
(21, 15, 3, 1, 14, '2017-10-12 20:00:11'),
(22, 16, 7, 1, 15, '2017-10-12 20:02:02'),
(23, 16, 58, 1, 16, '2017-10-12 20:02:40'),
(24, 17, 15, 1, 17, '2017-10-12 20:03:19'),
(25, 18, 50, 1, 18, '2017-10-12 20:03:33'),
(26, 19, 100, 1, 19, '2017-10-12 20:03:49'),
(27, 20, 100, 1, 20, '2017-10-12 20:04:11'),
(28, 21, 100, 1, 21, '2017-10-12 20:04:31'),
(29, 22, 100, 1, 22, '2017-10-12 20:04:47'),
(30, 23, 100, 1, 23, '2017-10-12 20:05:02'),
(31, 25, 100, 1, 24, '2017-10-12 20:05:16'),
(32, 26, 100, 1, 25, '2017-10-12 20:05:55'),
(33, 27, 100, 1, 26, '2017-10-12 20:06:07'),
(34, 28, 100, 1, 27, '2017-10-12 20:06:21'),
(35, 29, 100, 1, 28, '2017-10-12 20:06:40'),
(36, 30, 100, 1, 29, '2017-10-12 20:07:14'),
(37, 31, 100, 1, 30, '2017-10-12 20:07:25'),
(38, 32, 100, 1, 31, '2017-10-12 20:07:40'),
(39, 33, 100, 1, 32, '2017-10-12 20:07:54'),
(40, 34, 100, 1, 33, '2017-10-12 20:08:07'),
(41, 35, 100, 1, 34, '2017-10-12 20:08:24'),
(42, 36, 100, 1, 35, '2017-10-12 20:08:40'),
(43, 42, 75, 1, 36, '2017-10-12 20:08:54'),
(44, 43, 75, 1, 37, '2017-10-12 20:09:09'),
(45, 44, 75, 1, 38, '2017-10-12 20:09:33'),
(46, 45, 100, 1, 39, '2017-10-12 20:09:51'),
(47, 46, 75, 1, 40, '2017-10-12 20:10:27'),
(48, 47, 75, 1, 41, '2017-10-12 20:10:40'),
(49, 48, 75, 1, 42, '2017-10-12 20:10:54'),
(50, 49, 75, 1, 43, '2017-10-12 20:11:05'),
(51, 50, 75, 1, 44, '2017-10-12 20:11:19'),
(52, 51, 75, 1, 45, '2017-10-12 20:11:34'),
(53, 52, 100, 1, 46, '2017-10-12 20:12:35'),
(54, 54, 100, 1, 47, '2017-10-12 20:13:05'),
(55, 55, 100, 1, 48, '2017-10-12 20:13:19'),
(56, 56, 100, 1, 49, '2017-10-12 20:13:32'),
(57, 57, 100, 1, 50, '2017-10-12 20:13:50'),
(58, 58, 100, 1, 51, '2017-10-12 20:15:17'),
(59, 59, 100, 1, 52, '2017-10-12 20:15:32'),
(60, 60, 100, 1, 53, '2017-10-12 20:15:45'),
(61, 61, 100, 1, 54, '2017-10-12 20:15:57'),
(62, 62, 100, 1, 55, '2017-10-13 18:32:53'),
(63, 63, 100, 1, 56, '2017-10-13 18:33:22'),
(64, 64, 100, 1, 57, '2017-10-13 18:33:49'),
(65, 65, 100, 1, 58, '2017-10-13 18:34:15'),
(66, 66, 100, 1, 59, '2017-10-13 18:34:35'),
(67, 67, 100, 1, 60, '2017-10-13 18:34:59'),
(68, 68, 100, 1, 61, '2017-10-13 18:35:24'),
(69, 69, 100, 1, 62, '2017-10-13 18:36:00'),
(70, 70, 100, 1, 63, '2017-10-13 18:36:18'),
(71, 71, 100, 1, 64, '2017-10-13 18:36:36'),
(72, 72, 100, 1, 65, '2017-10-13 18:36:54'),
(73, 73, 100, 1, 66, '2017-10-13 18:37:13'),
(74, 74, 75, 1, 67, '2017-10-13 18:37:31'),
(75, 75, 75, 1, 68, '2017-10-13 18:37:52'),
(76, 76, 75, 1, 69, '2017-10-13 18:38:11'),
(80, 73, 20, 2, 1, '2017-11-07 02:07:28'),
(81, 5, 5, 2, 1, '2017-11-07 02:09:14');
/*!40000 ALTER TABLE `operation` ENABLE KEYS */;
-- Dumping structure for table inventiolite.operation_type
CREATE TABLE IF NOT EXISTS `operation_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.operation_type: ~2 rows (approximately)
/*!40000 ALTER TABLE `operation_type` DISABLE KEYS */;
INSERT INTO `operation_type` (`id`, `name`) VALUES
(1, 'entrada'),
(2, 'salida');
/*!40000 ALTER TABLE `operation_type` ENABLE KEYS */;
-- Dumping structure for table inventiolite.person
CREATE TABLE IF NOT EXISTS `person` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`image` varchar(255) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`lastname` varchar(50) NOT NULL,
`company` varchar(50) DEFAULT NULL,
`address1` varchar(50) DEFAULT NULL,
`address2` varchar(50) DEFAULT NULL,
`phone1` varchar(50) DEFAULT NULL,
`phone2` varchar(50) DEFAULT NULL,
`email1` varchar(50) DEFAULT NULL,
`email2` varchar(50) DEFAULT NULL,
`kind` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.person: ~17 rows (approximately)
/*!40000 ALTER TABLE `person` DISABLE KEYS */;
INSERT INTO `person` (`id`, `image`, `name`, `lastname`, `company`, `address1`, `address2`, `phone1`, `phone2`, `email1`, `email2`, `kind`, `created_at`) VALUES
(1, NULL, 'Juan ', 'Perez', NULL, '5ta. calle 6-23 zona 1', NULL, '58526987', NULL, 'jperez@gmail.com', NULL, 2, '2017-10-12 22:38:41'),
(2, NULL, 'Luis ', 'Gonzales', NULL, '23 Calle 2-69, Zona 9', NULL, '22546987', NULL, 'lgg@grupoci,com', NULL, 2, '2017-10-12 22:39:35'),
(3, NULL, 'Mynor', 'Jerez', NULL, '5 calle 8-96, zona 10', NULL, '22547412', NULL, 'mjerez@company247.com', NULL, 2, '2017-10-12 22:40:30'),
(4, NULL, 'Cristian', 'Granados', NULL, '9 calle 7-88, zona 13', NULL, '22145878', NULL, 'CG@123company.com', NULL, 2, '2017-10-12 22:41:56'),
(5, NULL, 'Estuardo', 'Chinchilla', NULL, '7 calle 2-96, zona 18', NULL, '54879632', NULL, 'echin@gmail.com', NULL, 2, '2017-10-12 22:42:44'),
(6, NULL, 'Jesus', 'Ochoa', NULL, '22 calle 7-55, zona 7', NULL, '22417458', NULL, 'jochoa@gruposky.com', NULL, 2, '2017-10-12 22:44:23'),
(7, NULL, 'Mirna', 'Ortiz', NULL, '9 calle 8-55, zona 11', NULL, '54741236', NULL, 'mortiz@hotmail.com', NULL, 2, '2017-10-12 22:45:16'),
(8, NULL, 'Luisa', 'Spencer', NULL, '8 calle 7-44, zona 14', NULL, '21478954', NULL, 'lspencer@groupcl.com', NULL, 2, '2017-10-12 22:46:11'),
(9, NULL, 'Elisa', 'Garcia', NULL, '4 calle 7-44, zona 16', NULL, '41745698', NULL, 'eligar@gmail.com', NULL, 2, '2017-10-12 22:47:07'),
(10, NULL, 'Karen', 'Muñoz', NULL, '3 calle 1-11, zona 2', NULL, '36985474', NULL, 'kmuñoz@kingco.com', NULL, 2, '2017-10-12 22:48:15'),
(11, NULL, 'Mayra', 'Faggiolli', NULL, '7a. avenida 8-35 zona 9', NULL, '77853142', NULL, 'mayrafr@ferreteriauniversal.com', NULL, 2, '2017-10-13 05:01:04'),
(12, NULL, 'Reynaldo', 'Jaramillo', NULL, 'Ruta 1 4-05 zona 4', NULL, '54486321', NULL, 'jaramillo07@distritornillos.net', NULL, 2, '2017-10-13 05:05:00'),
(13, NULL, 'Summer', 'Ales', NULL, '8 avenida 9-21 zona 15', NULL, '34486565', NULL, 'gerente.general@ales.com.gt', NULL, 2, '2017-10-13 05:06:34'),
(14, NULL, 'Julio Estuardo', 'Perez', NULL, 'Ruta 0 8-90 zona 4', NULL, '52219785', NULL, 'estuardoperez@maquipesada.com', NULL, 2, '2017-10-13 05:08:10'),
(15, NULL, 'Raul Armando', 'Fernandez', NULL, '9 avenida 6-41 zona 16', NULL, '56823440', NULL, 'raulfer@pintuguasa.com', NULL, 2, '2017-10-13 05:14:25'),
(16, NULL, 'Francisco', 'Ramirez Lopez', NULL, '3 avenida 9-23 zona 1', NULL, '52274253', NULL, 'frankramirez@mensajeriaglobal.com', NULL, 2, '2017-10-13 05:16:38'),
(17, NULL, 'Maria Fernanda', 'Lopez Romero', NULL, '7a calle 7-32 zona 1', NULL, '23860014', NULL, 'gerencia@capacitaciongt.com', NULL, 2, '2017-10-13 05:18:41');
/*!40000 ALTER TABLE `person` ENABLE KEYS */;
-- Dumping structure for table inventiolite.product
CREATE TABLE IF NOT EXISTS `product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`image` varchar(255) DEFAULT NULL,
`barcode` varchar(50) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`description` text DEFAULT NULL,
`inventary_min` int(11) DEFAULT 10,
`price_in` float DEFAULT NULL,
`price_out` float DEFAULT NULL,
`unit` varchar(255) DEFAULT NULL,
`presentation` varchar(255) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`category_id` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`is_active` tinyint(1) DEFAULT 1,
PRIMARY KEY (`id`),
KEY `category_id` (`category_id`),
KEY `user_id` (`user_id`),
CONSTRAINT `product_ibfk_1` FOREIGN KEY (`category_id`) REFERENCES `category` (`id`),
CONSTRAINT `product_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.product: ~76 rows (approximately)
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` (`id`, `image`, `barcode`, `name`, `description`, `inventary_min`, `price_in`, `price_out`, `unit`, `presentation`, `user_id`, `category_id`, `created_at`, `is_active`) VALUES
(1, 'Librera_1_1.jpg', NULL, 'Librera 5 Repisas', 'Color: Cafe\r\nMarca: ZMOBILI\r\nDimensiones: 60 x 23.6 x 182 cm ', 20, 399.99, 599.99, '', 'Madera', 3, 5, '2017-10-12 16:36:09', 1),
(2, 'Mesa_Auxiliar.jpg', NULL, 'Mesa Auxiliar', '', 50, 199.99, 449.99, '', 'Madera', 3, 5, NULL, 1),
(3, 'Librera_Cubos.jpg', NULL, 'Librera Cubos', 'Color: Blanco/Beige\r\nDimensiones: 79 x 29.5 x 80 cm', 45, 399.99, 699.99, '', 'Madera', 3, 5, NULL, 1),
(4, 'Rack_Fusion.jpg', NULL, 'Rack Fusion', 'Centro de Entretenimiento\r\nDimensiones: 68.5x170x38 cm', 5, 999.99, 1699.99, '', 'Madera', 3, 5, NULL, 1),
(5, 'Librera_3_Repisas.jpg', NULL, 'Librera 3 Repisas', 'Color: Cafe Claro\r\nDimensiones: 60 x 23.6 x 90 cm', 25, 199.99, 399.99, '', 'Madera', 3, 5, NULL, 1),
(6, 'Mesa_Plegable.jpg', NULL, 'Mesa Plegable', 'Marca: Newstorm\r\nColor: Blanco\r\nDimensiones: 182 x 72 x 74 cm', 4, 399.99, 599.99, '', 'Plastico', 3, 5, NULL, 1),
(7, 'Mesa_de_Jardin.jpg', NULL, 'Mesa de Jardin', 'Juego de Muebles\r\nColor: Chocolate\r\nNo. Piezas: 3', 50, 419.99, 699.99, '', 'Vidrio-Metal', 3, 5, NULL, 1),
(8, 'Set_Mesa.jpg', NULL, 'Set de Mesa', 'Juego de Muebles con Sombrilla\r\nCantidad de Piezas: 6', 20, 999.99, 1999.99, '', 'Vidrio-Metal', 3, 5, NULL, 1),
(9, 'Sillon_Columpio.jpg', NULL, 'Sillon Columpio', 'Sillon para 3 personas. \r\nPeso de Soporte: 210 kg\r\nDimensiones: 110 x 170 x 153 cm', 35, 599.99, 799.99, '', 'Metal-Tela', 3, 5, NULL, 1),
(10, 'Sillon_Reclinable.jpg', NULL, 'Sillon Reclinable', 'Sillon Tipo Reclinable\r\nColor: Cafe \r\nDimensiones: 75 x 90 x 98 cm', 60, 1049.99, 1499.99, '', 'Microfibra', 3, 5, NULL, 1),
(11, 'Sillon.jpg', NULL, 'Sillon Normal', 'Sillon Bean Bag\r\nColor: Cafe Obscuro', 40, 799.99, 999.99, '', 'Cuero Sintetico', 3, 5, NULL, 1),
(12, 'Sofa_Cama_1.jpg', NULL, 'Sofa Cama', 'Color: Chocolate\r\nTipo: Reclinable', 45, 1199.99, 1399.99, '', 'Tela', 3, 5, NULL, 1),
(13, 'Banco_Bar.jpg', NULL, 'Banco Bar', 'Color: Negro\r\nDimensiones: 44 x 47 x 88 cm', 25, 299.99, 499.99, '', 'Metal', 3, 5, NULL, 1),
(14, 'Silla_Ann.jpg', NULL, 'Silla de Comedor', 'Color: Cafe\r\nDimensiones: 41 x 49.5 x 97.5 cm', 33, 99.99, 199.99, '', 'Metal', 3, 5, NULL, 1),
(15, 'Silla.jpg', NULL, 'Silla de Oficina', 'Marca: ZMOBILI\r\nColor: Azul/Verde\r\nDimensiones: 62 x 63 x 92 cm', 90, 799.99, 999.99, '', 'Acero-Mesh', 3, 5, NULL, 1),
(16, 'JugueteGoma.jpg', NULL, 'Juguete de Goma', 'Marca: KOLE\r\nEmite sonido. ', 78, 9.99, 19.99, '', 'Hule', 3, 4, NULL, 1),
(17, 'CasaPlastico.jpg', NULL, 'Casa para Perro', 'Marca: EGM\r\nColor: Azul\r\nAltura Puerta: 17 pulgadas', 54, 399.99, 599.99, '', 'Plastico', 3, 4, NULL, 1),
(18, 'ProtectorAsiento.jpg', NULL, 'Protector de Asiento', 'Marca: Cloralex', 60, 49.99, 99.99, '', 'Tela-Fieltro', 3, 4, NULL, 1),
(19, 'DispensadorAgua.jpg', NULL, 'Dispensador de Agua', 'Marca: PET MATE\r\nCapacidad: 0.75 Galones\r\nUso: Agua', 100, 79.99, 144.99, '', 'Plastico', 3, 4, NULL, 1),
(20, 'Asiento.jpg', NULL, 'Asiento para Mascota', 'Marca: ETNA', 50, 99.99, 149.99, '', 'Tela', 3, 4, NULL, 1),
(21, 'collar.jpg', NULL, 'Correa para Perro', 'Marca: FIERO', 30, 5.99, 9.99, '100', 'Metal', 3, 4, NULL, 1),
(22, 'CasaPortatil.jpg', NULL, 'Casa para Perro Portatil', 'Marca: ETNA\r\nTamano: Mediano\r\nColor: Beige', 25, 99.99, 149.99, '80', 'Tela', 3, 4, NULL, 1),
(23, 'EscalerasPerro.jpg', NULL, 'Escalera Portatil', 'Marca: ETNA\r\nColor: Beige\r\nDimensiones: 16 x 12 x 4 1/2', 45, 79.99, 169.99, '100', 'Plastico', 3, 4, NULL, 1),
(24, 'Chaleco.jpg', NULL, 'Chaleco Impermeable', 'Talla: M\r\nColor: Rosado', 40, 49.99, 89.99, '65', 'Nylon', 3, 4, '2017-10-12 18:02:02', 1),
(25, 'CollarCuero.jpg', NULL, 'Collar para Perro', 'Marca: Dog Lover', 50, 29.99, 49.99, '100', 'Cuero', 3, 4, NULL, 1),
(26, 'Arnes.jpg', NULL, 'Arnes ', 'Marca: Pet Town', 30, 49.99, 69.99, '55', '', 3, 4, NULL, 1),
(27, 'JuguetePeluche.jpg', NULL, 'Juguete de Peluche', 'Marca: Diggers\r\nDiseno: Animal', 30, 49.99, 69.99, '78', 'Peluche', 3, 4, NULL, 1),
(28, 'JaulaPerro.jpg', NULL, 'Jaula para Perro', 'Marca: Midwest\r\nColor: Negro\r\nTamano: Grande', 20, 799.99, 999.99, '50', 'Metal', 3, 4, NULL, 1),
(29, 'TransportadorMascotas.jpg', NULL, 'Transportador de Mascotas', 'Marca: Aspen\r\nColor: Gris\r\nTamano: Grande', 50, 999.99, 1499.99, '80', 'Metal', 3, 4, NULL, 1),
(30, 'SillonCama.jpg', NULL, 'Sillon Cama', 'Marca: Pet Store', 30, 119.99, 189.99, '75', 'Madera-Tela', 3, 4, NULL, 1),
(31, 'AmoladoraAngular.jpg', NULL, 'Amoladora Angular', 'Marca: DeWalt\r\nUso: Profes', 10, 499.99, 699.99, '36', 'Peso: 3.9 Libras', 3, 1, NULL, 1),
(32, 'Pulidora.jpg', NULL, 'Pulidora Orbital', 'Marca: TRUPER\r\nUso: Profesional\r\nTipo: Orbital', 30, 149.99, 399.99, '60', 'Peso: 1.2 Kg', 3, 1, NULL, 1),
(33, 'RotoMartillo.jpg', NULL, 'Rotomartillo Electrico', 'Marca: TRUPER\r\nTipo: Rotomartillo', 35, 199.99, 249.99, '70', '', 3, 1, NULL, 1),
(34, 'Cautin.jpg', NULL, 'Cautin Tipo Lapiz', 'Marca: PRETUL\r\n', 40, 29.99, 39.99, '100', '', 3, 1, NULL, 1),
(35, 'TaladroInalambrico.jpg', NULL, 'Taladro Inalambrico', 'Marca: PRETUL', 20, 199.99, 249.99, '45', '', 3, 1, NULL, 1),
(36, 'EngrapadoraManual.jpg', NULL, 'Engrapadora Manual', 'Marca: TRUPER\r\nTipo: Pistola', 15, 79.99, 99.99, '50', 'Metal Cromado', 3, 1, NULL, 1),
(37, 'EscaleraMetal.jpg', NULL, 'Escalera de Metal', 'Marca: ELEMENTS\r\nColor: Negro/Blanco', 25, 139.99, 199.99, '50', 'Metal', 3, 1, '2017-10-12 18:34:00', 1),
(38, 'CintaMetrica.jpg', NULL, 'Cinta Metrica', 'Marca: PRETUL\r\nColor: Amarillo', 44, 9.99, 14.99, '100', 'Metal', 3, 1, '2017-10-12 18:35:29', 1),
(39, 'MartilloUna.jpg', NULL, 'Martillo', 'Marca: PRETUL\r\nTamano del Mango: 11 pulgadas', 80, 29.99, 34.99, '200', 'Peso: 16 oz', 3, 1, '2017-10-12 18:36:57', 1),
(40, 'SetDestornilladores.jpg', NULL, 'Set de Destornilladores', 'Marca: STANLEY\r\nRango de Piezas: 1-10 piezas', 50, 39.99, 59.99, '100', '', 3, 1, '2017-10-12 18:38:10', 1),
(41, 'CajaHerramientas.jpg', NULL, 'Caja de Herramientas', 'Marca: TRUPER\r\nUso: Profesional\r\nColor: Gris', 50, 59.99, 79.99, 'Peso: 072 kg', 'Plastico', 3, 1, '2017-10-12 18:42:23', 1),
(42, 'CepilloCircular.jpg', NULL, 'Cepillo Circular', 'Marca: TRUPER\r\nTipo: Circular', 50, 9.99, 19.99, 'Unidad', 'Individual', 3, 1, NULL, 1),
(43, 'SierraProfesional.jpg', NULL, 'Sierra Profesional', 'Marca: TRUPER\r\nUso: Profesional', 56, 499.99, 599.99, 'Unidad', '', 3, 1, NULL, 1),
(44, 'DesarmadorInalambrico.jpg', NULL, 'Desarmador Inalambrico', 'Marca: SKIL', 45, 179.99, 199.99, 'Unidad', 'Domestico', 3, 1, NULL, 1),
(45, 'SierraMadera.jpg', NULL, 'Sierra para Madera', 'Marca: TRUPER\r\nTipo: Caladora', 67, 14.99, 29.99, 'Unidad', 'Acero al Cromo', 3, 1, NULL, 1),
(46, 'VelaSet.jpg', NULL, 'Set de Velas', 'Marca: FLOR DE LIZ\r\nColor: Variedad\r\nCantidad de Piezas: 6', 50, 9.99, 19.99, 'Unidad', 'Set', 3, 2, NULL, 1),
(47, 'MarcoFotos.jpg', NULL, 'Marco para Fotos', 'Marca: FLOR DE LIZ\r\nContenido: Para 3 fotos', 25, 19.99, 29.99, 'Unidad', 'Plastico', 3, 2, NULL, 1),
(48, 'Individual2.jpg', NULL, 'Individual', 'Marca: VIVA\r\nCantidad de Piezas: 1', 15, 9.99, 19.99, 'Unidad', 'Plastico', 3, 2, NULL, 1),
(49, 'EucaliptoBrillante.jpg', NULL, 'Eucalipto Brillante', 'Marca: KOTZIJAL\r\nFollaje seco\r\nCantidad de Piezas: 6 tallos', 60, 39.99, 59.99, 'Unidad', 'Natural', 3, 2, NULL, 1),
(50, 'Setmadera.jpg', NULL, 'Set Galeria Doble Madera', 'Marca: VIVA\r\nTipo: Doble\r\nColor: Cafe', 80, 149.99, 299.99, 'Diametro Barra: 2.5/2.3 cm', 'Doble', 3, 2, NULL, 1),
(51, 'CortinaBambu.jpg', NULL, 'Cortina de Bambu', 'Decoracion', 100, 199.99, 279.99, 'Unidad', 'Empaquetado', 3, 2, NULL, 1),
(52, 'Individual.jpg', NULL, 'Individual Bamboo', 'Color: Natural\r\nForma: Rectangular', 56, 9.99, 14.99, 'Unidad', 'Individual', 3, 2, NULL, 1),
(54, 'PlatoDorado.jpg', NULL, 'Plato Base Dorado', 'Color: Dorado', 50, 19.99, 24.99, 'Unidad', 'Individual', 3, 2, NULL, 1),
(55, 'GaleriaCortina.jpg', NULL, 'Galeria para Cortina', 'Marca: VIVA\r\nTipo: Extensible\r\nColor: Dorado Antiguo', 58, 199.99, 249.99, 'Unidad', 'Metal', 3, 2, NULL, 1),
(56, 'PersianaBambu.jpg', NULL, 'Persiana Bamboo', 'Marca: VIVA\r\nColor: Cafe Claro', 45, 199.99, 299.99, 'Unidad', 'Empaquetado', 3, 2, NULL, 1),
(57, 'PlatoBase_2.jpg', NULL, 'Plato Base Redondo', 'Plato de Decoracion', 45, 19.99, 39.99, 'Unidad', 'Individual', 3, 2, NULL, 1),
(58, 'FarolCuadrado.jpg', NULL, 'Farol Cuadrado', '', 15, 59.99, 99.99, 'Unidad', 'Metal', 3, 2, NULL, 1),
(59, 'ExtensionSolar.jpg', NULL, 'Extension Solar de Faros', 'Marca: SOLARIS\r\nForma: Colgante\r\nLuz: LED', 78, 99.99, 149.99, 'Unidad', 'Metalica-Individual', 3, 2, NULL, 1),
(60, 'Cojin.jpg', NULL, 'Cojin', 'Color: Variedad', 50, 49.99, 99.99, 'Unidad', 'Individual-Colores', 3, 2, NULL, 1),
(61, 'Espejo.jpg', NULL, 'Espejo de Pared', 'Tamano: Pequeno\r\nCantidad de Piezas: 1', 30, 49.99, 89.99, 'Unidad', 'Marco de Madera', 3, 2, NULL, 1),
(62, 'Minibar.jpg', NULL, 'Mini Bar de manera', 'Incluye copas, no botellas. ', 50, 149.99, 249.99, 'Unidad', 'Madera', 3, 3, NULL, 1),
(63, 'Contenedores.jpg', NULL, 'Contenedores para Comida', 'Marca: ELEMENTS\r\nFormas: Cuadrado, Rectangular, Redondo\r\nColor: Transparente', 20, 49.99, 59.99, 'Unidad', 'Plastico, A presion', 3, 3, NULL, 1),
(64, 'SetTazones.jpg', NULL, 'Set de 5 Tazones', 'Marca: Nordika\r\nVasijas para Mezclar\r\nCantidad de Piezas: 5', 25, 29.99, 49.99, 'Unidad', 'Vidrio', 3, 3, NULL, 1),
(65, 'SetEspecieros.jpg', NULL, 'Set de Especieros', 'Forma: Redonda\r\nColor: Transparente\r\nPiezas: 6', 15, 39.99, 69.99, 'Unidad', 'Vidrio-Metal', 3, 3, NULL, 1),
(66, 'DispensadorAgua_1.jpg', NULL, 'Dispensador de Agua', 'Color: Natural\r\nForma: Cuadrado', 30, 69.99, 119.99, 'Unidad', 'Plastico', 3, 3, NULL, 1),
(67, 'MoldeMuffin.jpg', NULL, 'Molde de Muffins', 'Marca: GOOD COOK\r\nCantidad de piezas: 1', 25, 19.99, 29.99, 'Unidad', 'Aluminio', 3, 3, NULL, 1),
(68, 'PortaCuchillos.jpg', NULL, 'Porta Cubiertos', 'Retenedor de Utensilios\r\nColor: Cafe Oscuro\r\nPiezas: 9', 8, 79.99, 139.99, 'Unidad', 'Madera de Pino con Barniz', 3, 3, NULL, 1),
(69, 'SetCuchillos.jpg', NULL, 'Set de Cuchillos', 'Marca: TRAMONTINA\r\nColor: Negro\r\nPiezas: 6', 20, 99.99, 149.99, 'Unidad', 'Acero Inoxidable, Plastico', 3, 3, NULL, 1),
(70, 'BateriaCocina.jpg', NULL, 'Bateria de Cocina 8 piezas', 'Marca: NORDIKA\r\nPiezas: 8\r\nColor: Plateado', 16, 299.99, 499.99, 'Unidad', 'Vidrio, Acero Inoxidable', 3, 3, NULL, 1),
(71, 'BateriaCocinaRojo.jpg', NULL, 'Bateria de Cocina 10 Piezas', 'Marca: TRAMONTINA\r\nAntiadherente: Si\r\nColor: Rojo', 10, 499.99, 899.99, 'Unidad', 'Aluminio/Antiadherente', 3, 3, NULL, 1),
(72, 'BateriaAcero.jpg', NULL, 'Bateria de Cocina 12 Piezas', 'Marca: TRAMONTINA', 4, 599.99, 1199.99, 'Unidad', 'Acero Inoxidable, Plastico', 3, 3, NULL, 1),
(73, 'Comal.jpg', NULL, 'Comalito', 'Marca: ALDURA\r\nDiametro: 28 cm\r\nColor: Negro', 25, 99.99, 129.99, 'Unidad', 'Metal', 3, 3, NULL, 1),
(74, 'Gallinita.jpg', NULL, 'Canasta Diseno Gallinita', 'Marca: NORDIKA\r\nRetenedor/Cesta de Frutas/Huevos\r\nColor: Gris', 50, 39.99, 69.99, 'Unidad', 'Metal', 3, 3, NULL, 1),
(75, 'Desayunador.jpg', NULL, 'Desayunador para Cama', 'Tamano: Grande\r\nPlegable', 40, 169.99, 299.99, 'Unidad', 'Madera', 3, 3, NULL, 1),
(76, 'VasoAcero.jpg', NULL, 'Vaso de Acero Inoxidable', 'Marca: OSTER\r\nCapacidad de Vaso: 5 tazas', 38, 99.99, 149.99, 'Unidad', 'Acero Inoxidable', 3, 3, NULL, 1);
/*!40000 ALTER TABLE `product` ENABLE KEYS */;
-- Dumping structure for table inventiolite.sell
CREATE TABLE IF NOT EXISTS `sell` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`person_id` int(11) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`operation_type_id` int(11) DEFAULT 2,
`box_id` int(11) DEFAULT NULL,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`),
KEY `box_id` (`box_id`),
KEY `operation_type_id` (`operation_type_id`),
KEY `user_id` (`user_id`),
KEY `person_id` (`person_id`),
CONSTRAINT `sell_ibfk_1` FOREIGN KEY (`box_id`) REFERENCES `box` (`id`),
CONSTRAINT `sell_ibfk_2` FOREIGN KEY (`operation_type_id`) REFERENCES `operation_type` (`id`),
CONSTRAINT `sell_ibfk_3` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `sell_ibfk_4` FOREIGN KEY (`person_id`) REFERENCES `person` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.sell: ~69 rows (approximately)
/*!40000 ALTER TABLE `sell` DISABLE KEYS */;
INSERT INTO `sell` (`id`, `person_id`, `user_id`, `operation_type_id`, `box_id`, `created_at`) VALUES
(1, NULL, 3, 1, NULL, '2017-10-12 19:52:55'),
(2, NULL, 3, 1, NULL, '2017-10-12 19:53:13'),
(3, NULL, 3, 1, NULL, '2017-10-12 19:53:41'),
(4, NULL, 3, 1, NULL, '2017-10-12 19:55:06'),
(5, NULL, 3, 1, NULL, '2017-10-12 19:55:28'),
(6, NULL, 3, 1, NULL, '2017-10-12 19:55:54'),
(7, NULL, 3, 1, NULL, '2017-10-12 19:56:17'),
(8, NULL, 3, 1, NULL, '2017-10-12 19:56:32'),
(9, NULL, 3, 1, NULL, '2017-10-12 19:56:50'),
(10, NULL, 3, 1, NULL, '2017-10-12 19:57:14'),
(11, NULL, 3, 1, NULL, '2017-10-12 19:57:32'),
(12, NULL, 3, 1, NULL, '2017-10-12 19:57:56'),
(13, NULL, 3, 1, NULL, '2017-10-12 19:58:14'),
(14, NULL, 3, 1, NULL, '2017-10-12 20:00:11'),
(15, NULL, 3, 1, NULL, '2017-10-12 20:02:02'),
(16, NULL, 3, 1, NULL, '2017-10-12 20:02:40'),
(17, NULL, 3, 1, NULL, '2017-10-12 20:03:19'),
(18, NULL, 3, 1, NULL, '2017-10-12 20:03:33'),
(19, NULL, 3, 1, NULL, '2017-10-12 20:03:49'),
(20, NULL, 3, 1, NULL, '2017-10-12 20:04:11'),
(21, NULL, 3, 1, NULL, '2017-10-12 20:04:31'),
(22, NULL, 3, 1, NULL, '2017-10-12 20:04:47'),
(23, NULL, 3, 1, NULL, '2017-10-12 20:05:02'),
(24, NULL, 3, 1, NULL, '2017-10-12 20:05:16'),
(25, NULL, 3, 1, NULL, '2017-10-12 20:05:55'),
(26, NULL, 3, 1, NULL, '2017-10-12 20:06:07'),
(27, NULL, 3, 1, NULL, '2017-10-12 20:06:21'),
(28, NULL, 3, 1, NULL, '2017-10-12 20:06:40'),
(29, NULL, 3, 1, NULL, '2017-10-12 20:07:13'),
(30, NULL, 3, 1, NULL, '2017-10-12 20:07:25'),
(31, NULL, 3, 1, NULL, '2017-10-12 20:07:40'),
(32, NULL, 3, 1, NULL, '2017-10-12 20:07:54'),
(33, NULL, 3, 1, NULL, '2017-10-12 20:08:07'),
(34, NULL, 3, 1, NULL, '2017-10-12 20:08:24'),
(35, NULL, 3, 1, NULL, '2017-10-12 20:08:40'),
(36, NULL, 3, 1, NULL, '2017-10-12 20:08:54'),
(37, NULL, 3, 1, NULL, '2017-10-12 20:09:09'),
(38, NULL, 3, 1, NULL, '2017-10-12 20:09:33'),
(39, NULL, 3, 1, NULL, '2017-10-12 20:09:51'),
(40, NULL, 3, 1, NULL, '2017-10-12 20:10:27'),
(41, NULL, 3, 1, NULL, '2017-10-12 20:10:40'),
(42, NULL, 3, 1, NULL, '2017-10-12 20:10:54'),
(43, NULL, 3, 1, NULL, '2017-10-12 20:11:05'),
(44, NULL, 3, 1, NULL, '2017-10-12 20:11:19'),
(45, NULL, 3, 1, NULL, '2017-10-12 20:11:34'),
(46, NULL, 3, 1, NULL, '2017-10-12 20:12:35'),
(47, NULL, 3, 1, NULL, '2017-10-12 20:13:05'),
(48, NULL, 3, 1, NULL, '2017-10-12 20:13:19'),
(49, NULL, 3, 1, NULL, '2017-10-12 20:13:32'),
(50, NULL, 3, 1, NULL, '2017-10-12 20:13:50'),
(51, NULL, 3, 1, NULL, '2017-10-12 20:15:17'),
(52, NULL, 3, 1, NULL, '2017-10-12 20:15:32'),
(53, NULL, 3, 1, NULL, '2017-10-12 20:15:45'),
(54, NULL, 3, 1, NULL, '2017-10-12 20:15:57'),
(55, 14, 3, 1, NULL, '2017-10-13 18:32:53'),
(56, 7, 3, 1, NULL, '2017-10-13 18:33:22'),
(57, 11, 3, 1, NULL, '2017-10-13 18:33:49'),
(58, 4, 3, 1, NULL, '2017-10-13 18:34:15'),
(59, 17, 3, 1, NULL, '2017-10-13 18:34:34'),
(60, 3, 3, 1, NULL, '2017-10-13 18:34:59'),
(61, 8, 3, 1, NULL, '2017-10-13 18:35:24'),
(62, 9, 3, 1, NULL, '2017-10-13 18:36:00'),
(63, 15, 3, 1, NULL, '2017-10-13 18:36:18'),
(64, 13, 3, 1, NULL, '2017-10-13 18:36:36'),
(65, 12, 3, 1, NULL, '2017-10-13 18:36:54'),
(66, 3, 3, 1, NULL, '2017-10-13 18:37:13'),
(67, 10, 3, 1, NULL, '2017-10-13 18:37:31'),
(68, 8, 3, 1, NULL, '2017-10-13 18:37:52'),
(69, 10, 3, 1, NULL, '2017-10-13 18:38:11');
/*!40000 ALTER TABLE `sell` ENABLE KEYS */;
-- Dumping structure for table inventiolite.stock
CREATE TABLE IF NOT EXISTS `stock` (
`product_id` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(100) DEFAULT NULL,
`disponible` float DEFAULT NULL,
`comprometidas` float DEFAULT NULL,
PRIMARY KEY (`product_id`)
) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.stock: ~76 rows (approximately)
/*!40000 ALTER TABLE `stock` DISABLE KEYS */;
INSERT INTO `stock` (`product_id`, `nombre`, `disponible`, `comprometidas`) VALUES
(1, 'Librera 5 Repisas', 50, 0),
(2, 'Mesa Auxiliar', 85, 0),
(3, 'Librera Cubos', 50, 0),
(4, 'Rack Fusion', 55, 0),
(5, 'Librera 3 Repisas', 25, 0),
(6, 'Mesa Plegable', 5, 0),
(7, 'Mesa de JardÃn', 15, 0),
(8, 'Set de Mesa', 35, 0),
(9, 'Sillón Columpio', 40, 0),
(10, 'Sillón Reclinable', 20, 0),
(11, 'Sillón Normal', 20, 0),
(12, 'Sofá Cama', 5, 0),
(13, 'Banco Bar', 50, 0),
(14, 'Silla de Comedor', 150, 0),
(15, 'Silla de Oficina', 3, 0),
(16, 'Juguete de Goma', 65, 0),
(17, 'Casa para Perro', 15, 0),
(18, 'Protector de Asiento', 50, 0),
(19, 'Dispensador de Agua', 100, 0),
(20, 'Asiento para Mascota', 100, 0),
(21, 'Correa para Perro', 100, 0),
(22, 'Casa para Perro Portátil', 100, 0),
(23, 'Escalera Portátil', 100, 0),
(24, 'Chaleco Impermeable', 100, 0),
(25, 'Collar para Perro', 100, 0),
(26, 'Arnés ', 100, 0),
(27, 'Juguete de Peluche', 100, 0),
(28, 'Jaula para Perro', 100, 0),
(29, 'Transportador de Mascotas', 100, 0),
(30, 'Sillón Cama', 100, 0),
(31, 'Amoladora Angular', 100, 0),
(32, 'Pulidora Orbital', 100, 0),
(33, 'Rotomartillo Eléctrico', 100, 0),
(34, 'Cautín Tipo Lápiz', 100, 0),
(35, 'Taladro Inalámbrico', 100, 0),
(36, 'Engrapadora Manual', 100, 0),
(37, 'Escalera de Metal', 50, 0),
(38, 'Cinta Métrica', 100, 0),
(39, 'Martillo', 200, 0),
(40, 'Set de Destornilladores', 100, 0),
(41, 'Caja de Herramientas', 100, 0),
(42, 'Cepillo Circular', 75, 0),
(43, 'Sierra Profesional', 75, 0),
(44, 'Desarmador Inalámbrico', 75, 0),
(45, 'Sierra para Mader', 100, 0),
(46, 'Set de Velas', 75, 0),
(47, 'Marco para Fotos', 75, 0),
(48, 'Individual', 75, 0),
(49, 'Eucalipto Brillante', 75, 0),
(50, 'Set Galería Doble Madera', 75, 0),
(51, 'Cortina de Bambú', 75, 0),
(52, 'Individual Bamboo', 100, 0),
(53, 'Plato Base Redondo', 0, 0),
(54, 'Plato Base Dorado', 100, 0),
(55, 'Galería para Cortina', 100, 0),
(56, 'Persiana Bambú', 100, 0),
(57, 'Plato Base Redondo', 100, 0),
(58, 'Farol Cuadrado', 100, 0),
(59, 'Extensión Solar de Faros', 100, 0),
(60, 'Cojín', 100, 0),
(61, 'Espejo de Pared', 100, 0),
(62, 'Mini Bar de manera', 100, 0),
(63, 'Contenedores para Comida', 100, 0),
(64, 'Set de 5 Tazones', 100, 0),
(65, 'Set de Especieros', 100, 0),
(66, 'Dispensador de Agua', 100, 0),
(67, 'Molde de Muffins', 100, 0),
(68, 'Porta Cubiertos', 100, 0),
(69, 'Set de Cuchillos', 100, 0),
(70, 'Batería de Cocina 8 piezas', 100, 0),
(71, 'Batería de Cocina 10 Piezas', 100, 0),
(72, 'Batería de Cocina 12 Piezas', 100, 0),
(73, 'Comalito', 80, 0),
(74, 'Canasta Diseño Gallinita', 75, 0),
(75, 'Desayunador para Cama', 75, 0),
(76, 'Vaso de Acero Inoxidable', 75, 0);
/*!40000 ALTER TABLE `stock` ENABLE KEYS */;
-- Dumping structure for table inventiolite.user
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL,
`username` varchar(50) DEFAULT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(60) NOT NULL,
`image` varchar(255) DEFAULT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT 1,
`is_admin` tinyint(1) NOT NULL DEFAULT 0,
`created_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
-- Dumping data for table inventiolite.user: ~2 rows (approximately)
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` (`id`, `name`, `lastname`, `username`, `email`, `password`, `image`, `is_active`, `is_admin`, `created_at`) VALUES
(3, 'Administrador', '', '', 'admin', '90b9aa7e25f80cf4f64e990b78a9fc5ebd6cecad', NULL, 1, 1, '2017-10-10 20:40:01'),
(4, 'prueba', 'prueba', 'prueba', 'prueba@correo.com', '10470c3b4b1fed12c3baac014be15fac67c6e815', NULL, 1, 0, '2017-11-04 13:26:07');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
-- Dumping structure for trigger inventiolite.operation_after_insert
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `operation_after_insert` BEFORE INSERT ON `operation` FOR EACH ROW BEGIN
IF NEW.operation_type_id = 1 THEN
UPDATE stock SET
disponible = disponible + new.q
WHERE product_id = new.product_id;
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger inventiolite.operation_before_delete
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `operation_before_delete` BEFORE DELETE ON `operation` FOR EACH ROW BEGIN
IF old.operation_type_id = 1 THEN
UPDATE stock SET
disponible = disponible - old.q
WHERE product_id = old.product_id;
END IF;
IF old.operation_type_id = 2 THEN
UPDATE stock SET
disponible = disponible + old.q
WHERE product_id = old.product_id;
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger inventiolite.product_after_insert
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `product_after_insert` AFTER INSERT ON `product` FOR EACH ROW BEGIN
INSERT INTO STOCK
(product_id, nombre, disponible, comprometidas)
VALUES
(NEW.id, NEW.name, 0,0);
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
-- Dumping structure for trigger inventiolite.stock_before_update
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `stock_before_update` BEFORE UPDATE ON `stock` FOR EACH ROW BEGIN
IF NEW.disponible <> OLD.disponible THEN
INSERT INTO operation
(product_id, q, operation_type_id, sell_id,created_at)
VALUES
(NEW.product_id , OLD.disponible - NEW.disponible, 2,1, NOW());
END IF;
END//
DELIMITER ;
SET SQL_MODE=@OLDTMP_SQL_MODE;
/*!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 */;
|
~ Failed DROP can be ignored if necessary
drop table T_TEST if exists;
~ Create the demo.test table
create table T_TEST (NAME varchar(50) not null); |
ALTER USER root IDENTIFIED WITH mysql_native_password BY 'mamram';
CREATE DATABASE `core`;
USE `core`;
CREATE TABLE `boards` (
`board_id` INT(11) NOT NULL,
`title` VARCHAR(300) NOT NULL,
`createdAt` TIMESTAMP NULL DEFAULT NULL,
`updatedAt` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`board_id`)
) ENGINE=InnoDB;
CREATE TABLE `persons` (
`person_id` INT(11) NOT NULL,
`firstName` VARCHAR(300) NOT NULL,
`lastName` VARCHAR(300) NOT NULL,
`team` VARCHAR(300) NOT NULL,
`board_id` INT(11) NOT NULL,
`createdAt` TIMESTAMP NULL DEFAULT NULL,
`updatedAt` TIMESTAMP NULL DEFAULT NULL,
PRIMARY KEY (`person_id`)
) ENGINE=InnoDB;
INSERT INTO `boards` (`board_id`, `title`) VALUES
(1, 'board #1'),
(2, 'board #2'),
(3, 'board #3');
INSERT INTO `persons` (`person_id`, `firstName`, `lastName`, `team`, `board_id`) VALUES
(1, 'Eddard', 'Stark', 'north', 3),
(2, 'Catelyn', 'Stark', 'north', 3),
(3, 'Jaime', 'Lannister', 'south', 3),
(4, 'Cersei', 'Lannister', 'south', 3);
|
-- phpMyAdmin SQL Dump
-- version 4.8.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 08, 2019 at 04:27 PM
-- Server version: 10.1.31-MariaDB
-- PHP Version: 7.2.4
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: `recop-comex`
--
-- --------------------------------------------------------
--
-- Table structure for table `audit_trail`
--
CREATE TABLE `audit_trail` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`affected_id` int(11) NOT NULL,
`target` varchar(20) NOT NULL,
`date_created` datetime NOT NULL,
`type` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `community`
--
CREATE TABLE `community` (
`id` int(11) NOT NULL,
`member_id` int(11) DEFAULT NULL,
`community_id` int(11) DEFAULT NULL,
`occupation` varchar(30) DEFAULT NULL,
`income` decimal(10,2) NOT NULL,
`religion` varchar(20) NOT NULL,
`status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `donation`
--
CREATE TABLE `donation` (
`id` int(11) NOT NULL,
`sponsee_id` int(11) DEFAULT NULL,
`event_id` int(11) DEFAULT NULL,
`sponsor_id` int(11) DEFAULT NULL,
`amount` decimal(10,2) NOT NULL,
`date_given` datetime NOT NULL,
`transaction_slip` varchar(200) NOT NULL,
`status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `event_attachment`
--
CREATE TABLE `event_attachment` (
`id` int(11) NOT NULL,
`event_id` int(11) DEFAULT NULL,
`path` varchar(200) NOT NULL,
`type` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `event_information`
--
CREATE TABLE `event_information` (
`id` int(11) NOT NULL,
`organizer_id` int(11) DEFAULT NULL,
`name` varchar(30) NOT NULL,
`description` varchar(140) NOT NULL,
`objective` varchar(140) NOT NULL,
`budget` decimal(10,2) NOT NULL,
`location` varchar(50) NOT NULL,
`event_date` datetime NOT NULL,
`participant_no` int(11) NOT NULL,
`min_age` int(11) NOT NULL,
`max_age` int(11) NOT NULL,
`thrust` int(11) NOT NULL,
`type` int(1) NOT NULL,
`event_status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `event_participation`
--
CREATE TABLE `event_participation` (
`id` int(11) NOT NULL,
`event_id` int(11) DEFAULT NULL,
`participant_id` int(11) DEFAULT NULL,
`rating` int(11) DEFAULT NULL,
`comment` varchar(140) DEFAULT NULL,
`is_target` char(1) NOT NULL,
`status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `event_photo`
--
CREATE TABLE `event_photo` (
`id` int(11) NOT NULL,
`event_id` int(11) DEFAULT NULL,
`photo` varchar(200) NOT NULL,
`description` varchar(140) DEFAULT NULL,
`is_used` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `feedback`
--
CREATE TABLE `feedback` (
`id` int(11) NOT NULL,
`name` varchar(70) NOT NULL,
`email_address` varchar(60) NOT NULL,
`contact_no` varchar(15) DEFAULT NULL,
`query` varchar(140) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `inventory`
--
CREATE TABLE `inventory` (
`id` int(11) NOT NULL,
`donation_id` int(11) DEFAULT NULL,
`type_id` int(11) DEFAULT NULL,
`in_stock` int(11) NOT NULL,
`given` int(11) NOT NULL,
`expired` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `inventory_type`
--
CREATE TABLE `inventory_type` (
`id` int(11) NOT NULL,
`name` varchar(20) NOT NULL,
`status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `notifications`
--
CREATE TABLE `notifications` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`body` varchar(140) NOT NULL,
`status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `proposal_tracker`
--
CREATE TABLE `proposal_tracker` (
`id` int(11) NOT NULL,
`event_id` int(11) DEFAULT NULL,
`proposed_on` datetime NOT NULL,
`recop_accepted` datetime DEFAULT NULL,
`acad_signed` datetime DEFAULT NULL,
`fmi_signed` datetime DEFAULT NULL,
`approved_on` datetime DEFAULT NULL,
`comment` varchar(20) DEFAULT NULL,
`status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `referral`
--
CREATE TABLE `referral` (
`id` int(11) NOT NULL,
`referrer_id` int(11) DEFAULT NULL,
`name` varchar(50) NOT NULL,
`email_address` varchar(30) NOT NULL,
`type` int(1) NOT NULL,
`status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user_account`
--
CREATE TABLE `user_account` (
`id` int(11) NOT NULL,
`info_id` int(11) DEFAULT NULL,
`username` varchar(20) NOT NULL,
`password` varchar(60) NOT NULL,
`email_address` varchar(30) NOT NULL,
`type` int(1) NOT NULL,
`last_active` datetime NOT NULL,
`status` char(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user_information`
--
CREATE TABLE `user_information` (
`id` int(11) NOT NULL,
`first_name` varchar(30) NOT NULL,
`middle_name` varchar(20) NOT NULL,
`last_name` varchar(20) NOT NULL,
`company_name` varchar(50) NOT NULL,
`bio` varchar(160) DEFAULT NULL,
`gender` char(1) NOT NULL,
`birthday` date NOT NULL,
`address` varchar(100) NOT NULL,
`telephone` varchar(15) DEFAULT NULL,
`mobile_number` varchar(15) DEFAULT NULL,
`partner_thrust` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `user_photo`
--
CREATE TABLE `user_photo` (
`id` int(11) NOT NULL,
`user_id` int(11) DEFAULT NULL,
`path` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `audit_trail`
--
ALTER TABLE `audit_trail`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `community`
--
ALTER TABLE `community`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `donation`
--
ALTER TABLE `donation`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `event_attachment`
--
ALTER TABLE `event_attachment`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `event_information`
--
ALTER TABLE `event_information`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `event_participation`
--
ALTER TABLE `event_participation`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `event_photo`
--
ALTER TABLE `event_photo`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `feedback`
--
ALTER TABLE `feedback`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `inventory`
--
ALTER TABLE `inventory`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `inventory_type`
--
ALTER TABLE `inventory_type`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `notifications`
--
ALTER TABLE `notifications`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `proposal_tracker`
--
ALTER TABLE `proposal_tracker`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `referral`
--
ALTER TABLE `referral`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_account`
--
ALTER TABLE `user_account`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_information`
--
ALTER TABLE `user_information`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `user_photo`
--
ALTER TABLE `user_photo`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `audit_trail`
--
ALTER TABLE `audit_trail`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `community`
--
ALTER TABLE `community`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `donation`
--
ALTER TABLE `donation`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `event_attachment`
--
ALTER TABLE `event_attachment`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `event_information`
--
ALTER TABLE `event_information`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `event_participation`
--
ALTER TABLE `event_participation`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `event_photo`
--
ALTER TABLE `event_photo`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `feedback`
--
ALTER TABLE `feedback`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `inventory`
--
ALTER TABLE `inventory`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `inventory_type`
--
ALTER TABLE `inventory_type`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `notifications`
--
ALTER TABLE `notifications`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `proposal_tracker`
--
ALTER TABLE `proposal_tracker`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `referral`
--
ALTER TABLE `referral`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `user_account`
--
ALTER TABLE `user_account`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `user_information`
--
ALTER TABLE `user_information`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `user_photo`
--
ALTER TABLE `user_photo`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
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 */;
|
insert into product(id, title, price, inventorycount)
values(1, 'Racket', 20, 100);
insert into product(id, title, price, inventorycount)
values(2, 'Ball', 25, 500);
insert into product(id, title, price, inventorycount)
values(3, 'Rubber', 100, 10); |
CREATE TABLE etl.lut_divisa
(
id SERIAL NOT NULL PRIMARY KEY,
azienda_id INTEGER NOT NULL,
codice_sap VARCHAR(50) NOT NULL,
codice_gestionale INTEGER NOT NULL
);
INSERT INTO etl.lut_divisa (azienda_id, codice_sap, codice_gestionale) VALUES (1, 'EUR', 1);
INSERT INTO etl.lut_divisa (azienda_id, codice_sap, codice_gestionale) VALUES (1, 'USD', 2);
INSERT INTO etl.lut_divisa (azienda_id, codice_sap, codice_gestionale) VALUES (3, 'EUR', 1);
INSERT INTO etl.lut_divisa (azienda_id, codice_sap, codice_gestionale) VALUES (2, 'USD', 2); |
-- MySQL dump 10.13 Distrib 8.0.21, for Win64 (x86_64)
--
-- Host: localhost Database: hackathon_alfa
-- ------------------------------------------------------
-- Server version 8.0.21
/*!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 `cor`
--
DROP TABLE IF EXISTS `cor`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cor` (
`id` int NOT NULL AUTO_INCREMENT,
`cor` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cor`
--
LOCK TABLES `cor` WRITE;
/*!40000 ALTER TABLE `cor` DISABLE KEYS */;
INSERT INTO `cor` VALUES (1,'amarelo'),(2,'branco'),(3,'preto'),(4,'cinza'),(5,'azul claro'),(6,'cinza claro'),(7,'laranja');
/*!40000 ALTER TABLE `cor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `marca`
--
DROP TABLE IF EXISTS `marca`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `marca` (
`id` int NOT NULL AUTO_INCREMENT,
`marca` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `marca`
--
LOCK TABLES `marca` WRITE;
/*!40000 ALTER TABLE `marca` DISABLE KEYS */;
INSERT INTO `marca` VALUES (1,'mclaren'),(2,'Koenigsegg'),(3,'Bugatti'),(4,'SSC'),(5,'Hennessey');
/*!40000 ALTER TABLE `marca` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `usuario`
--
DROP TABLE IF EXISTS `usuario`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `usuario` (
`id` int NOT NULL AUTO_INCREMENT,
`nome` varchar(100) NOT NULL,
`login` varchar(20) NOT NULL,
`senha` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `usuario`
--
LOCK TABLES `usuario` WRITE;
/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
INSERT INTO `usuario` VALUES (1,'Gustavo','gu','12345'),(2,'leonardo','leo','67890'),(4,'vitor','vitor','123');
/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `veiculo`
--
DROP TABLE IF EXISTS `veiculo`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `veiculo` (
`id` int NOT NULL AUTO_INCREMENT,
`modelo` varchar(50) NOT NULL,
`anomodelo` year NOT NULL,
`anofabricacao` year NOT NULL,
`valor` double NOT NULL,
`tipo` enum('novo','seminovo') NOT NULL,
`fotoDestaque` varchar(200) NOT NULL,
`marca_id` int NOT NULL,
`cor_id` int NOT NULL,
`usuario_id` int NOT NULL,
`opcionais` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `veiculo`
--
LOCK TABLES `veiculo` WRITE;
/*!40000 ALTER TABLE `veiculo` DISABLE KEYS */;
INSERT INTO `veiculo` VALUES (1,'mclarenf1',1998,1975,50000,'novo','default.png',1,1,1,'opcionaios'),(2,'Koenigsegg CCR',2006,2004,4000000,'novo','HOR_XB1_Koenigsegg_CCX',2,7,1,''),(3,'Bugatti Veyron 16.4',2015,2005,7000000,'novo','d9025e3a3f3593da44bd48d85297d8fd',3,6,1,''),(4,'SSC Ultimate Aero TT',2013,2006,3000000,'novo','SSC-Ultimate-Aero-the-American',4,4,1,''),(5,'Bugatti Veyron Super Sport',2011,2010,15000000,'seminovo','ace63b2f6ccd29c7e567e070089fcd5b',3,5,2,''),(6,'Hennessey Venom GT',2017,2010,10000000,'seminovo','HOR_XB1_Hennessey_Venom',5,1,2,''),(7,'Koenigsegg Agera RS',2018,2015,5000000,'seminovo','HOR_XB1_Koenigsegg_Agera',2,3,2,''),(8,' Bugatti Chiron Super Sport 300+',2016,2016,20000000,'seminovo','chiron-sport-300-featured',3,5,2,'');
/*!40000 ALTER TABLE `veiculo` 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 2021-06-12 23:10:51
|
{DEFAULT @target_database = 'SJ_CLEAR_CDM4' }
USE [@target_database];
-- get SUMMARY
SELECT *
FROM MATCHING_TMP
|
CREATE TABLE AttachedFiles (
Id INT NOT NULL IDENTITY(1,1),
Name NVARCHAR(200),
MimeType NVARCHAR(200),
[Key] UNIQUEIDENTIFIER NOT NULL,
[Description] NVARCHAR(200)
CONSTRAINT PK_RegisterFiles PRIMARY KEY (Id)
);
|
CREATE TABLE IF NOT EXISTS drives (
uuid integer,
game_id integer,
first_play_id integer,
team varchar(3),
drive_number smallint,
how_obtained varchar(4),
quarter smallint,
minutes smallint,
seconds smallint,
starting_field_position smallint,
plays smallint,
successful_plays smallint,
rushing_first_downs smallint,
passing_first_downs smallint,
other_first_downs smallint,
rushing_attempts smallint,
rushing_yardage integer,
passing_attempts smallint,
passing_completions smallint,
passing_yardage integer,
penalty_yardage_for smallint,
penalty_yardage_against smallint,
net_yardage integer,
result varchar(4)
);
COPY drive
FROM '/Users/sean.costello/Development/nfl_00-16/DRIVE.csv' DELIMITER ',' CSV HEADER; |
1. Zbuduj zapytanie, które dla każdej podkategorii znajdzie liczbę produktów do niej należących.
Następnie utwórz ranking podkategorii ze względu liczbę na produktów.
/*V1
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
RANK() OVER(ORDER BY COUNT(*) DESC) RANKING
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID);
*/
2. Zmodyfikuj zapytanie z p. 1 w taki sposób, aby w zbiorze wynikowym pojawiła się dodatkowa
kolumna pokazująca ranking gęsty. Czy występują różnice pomiędzy rankingami?
/*V1
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
RANK() OVER(ORDER BY COUNT(*) DESC) RANKING,
DENSE_RANK() OVER(ORDER BY COUNT(*) DESC) RANKING_DENSE
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID);
*/
3. Zmodyfikuj zapytanie z poprzedniego punktu w taki sposób, aby otrzymać dane jedynie trzech
pierwszych podkategorii w rankingu (weź pod uwagę ranking zwykły).
/*V1
SELECT * FROM (
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
RANK() OVER(ORDER BY COUNT(*) DESC) RANKING,
DENSE_RANK() OVER(ORDER BY COUNT(*) DESC) RANKING_DENSE
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID))
WHERE RANKING < 4;
*/
4. Dokonaj kolejnej modyfikacji zapytania, tym razem chcemy uzyskać informacje o pięciu najmniej
Licznych podkategoriach (ponownie użyj zwykłego rankingu).
/*V1
SELECT * FROM (
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
RANK() OVER(ORDER BY COUNT(*) ASC) RANKING
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID))
WHERE RANKING < 5;
*/
5. Przekształć ranking, uzyskany w zadaniu 1., w ranking procentowy (użyj funkcji PERCENT_RANK).
Ogranicz wynik do dwóch pozycji po przecinku.
/*V1
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
ROUND(PERCENT_RANK() OVER(ORDER BY COUNT(*) DESC),2) RANKING
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID);
*/
6. Zmodyfikuj zapytanie z punktu poprzedniego w taki sposób, aby otrzymać informacje o podkategoriach,
które lokują się w 25% najliczniej obsadzonych podkategorii.
/*V1
WITH RANKING_TAB AS (
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
ROUND(PERCENT_RANK() OVER(ORDER BY COUNT(*) DESC),2) AS RANKING
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID))
SELECT * FROM RANKING_TAB
WHERE RANKING < 0.25;
*/
7. Dodaj do wyniku zadania 6. kolumnę wyliczającą percentyle (funkcja CUME_DIST). Porównaj wyniki uzyskane
w kolumnach RANKING_PROC i PERCENTYL.
WITH RANKING_TAB AS (
/*V1
WITH RANKING_TAB AS (
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
ROUND(PERCENT_RANK() OVER(ORDER BY COUNT(*) DESC),2) AS RANKING,
CUME_DIST() OVER(ORDER BY COUNT(*) DESC) AS PERCENTYL
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID))
SELECT * FROM RANKING_TAB
WHERE RANKING < 0.25;
*/
8. Podaj hipotetyczną pozycję w rankingu podkategorii, która zawiera dokładnie 9 produktów. Użyj rankingu
zwykłego.
/*V1
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
RANK() OVER(ORDER BY COUNT(*) DESC) RANKING
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID);
SELECT RANK(9) WITHIN GROUP
(ORDER BY COUNT(*) DESC) AS POSITION
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID);
*/
9. Przydziel każdej pozycji w rankingu podkategorii z punktu 1. unikalny numer porządkowy (wykorzystaj
funkcję ROW_NUMBER). Porównaj numer porządkowy rekordu z pozycją w rankingu.
/*V1
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
RANK() OVER(ORDER BY COUNT(*) DESC) RANKING,
ROW_NUMBER() OVER(ORDER BY COUNT(*) DESC) AS ROW_NUMBER
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID);
*/
10. Podziel podkategorie na cztery "koszyki" w zależności od ich pozycji w rankingu zbudowanym wg
liczby produktów. W każdym koszyku powinno znaleźć się tyle samo podkategorii (liczby podkategorii
w poszczególnych koszykach mogą się różnić o co najwyżej 1).
/*V1
SELECT PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID, COUNT(*),
RANK() OVER(ORDER BY COUNT(*) DESC) RANKING,
NTILE(4) OVER(ORDER BY COUNT(*) DESC) BUCKET
FROM H_PRODUCTS
GROUP BY (PROD_SUBCATEGORY,PROD_SUBCATEGORY_ID);
*/
|
DROP DATABASE IF EXISTS webapp;
CREATE DATABASE webapp
CHARACTER SET utf8
COLLATE utf8_general_ci;
USE webapp;
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`login` char(15) NOT NULL UNIQUE,
`password` char(15) NOT NULL,
`email` char(25) NOT NULL,
`role_id` int NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`id` int NOT NULL,
`name` char(15) NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `locale`;
CREATE TABLE `locale` (
`id` int NOT NULL,
`lang` char(15) NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `subjects`;
CREATE TABLE `subjects` (
`id` int NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `subject_info`;
CREATE TABLE `subject_info` (
`id` int NOT NULL AUTO_INCREMENT,
`subject_id` int NOT NULL,
`name` char(15) NOT NULL,
`locale_id` int NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `grades`;
CREATE TABLE `grades` (
`id` int NOT NULL AUTO_INCREMENT,
`entrant_id` int NOT NULL,
`subject_id` int NOT NULL,
`grade` int NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `facultys`;
CREATE TABLE `facultys` (
`id` int NOT NULL AUTO_INCREMENT,
`ms_id` int NOT NULL,
`ss_id` int NOT NULL,
`ts_id` int NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `faculty_info`;
CREATE TABLE `faculty_info` (
`id` int NOT NULL AUTO_INCREMENT,
`faculty_id` int NOT NULL,
`name` char(15) NOT NULL,
`description` LONGTEXT NOT NULL,
`locale_id` int NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `entrants`;
CREATE TABLE `entrants` (
`id` int NOT NULL AUTO_INCREMENT,
`is_blocked` boolean NOT NULL,
`user_id` int NOT NULL,
`email` char(25) NOT NULL,
`cetificate_url` char(25) NOT NULL,
`tel` char(15) NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `entrants_info`;
CREATE TABLE `entrants_info` (
`id` int NOT NULL AUTO_INCREMENT,
`entrant_id` int NOT NULL,
`first_name` char(15) NOT NULL,
`middle_name` char(15) NOT NULL,
`last_name` char(15) NOT NULL,
`adress` char(15) NOT NULL,
`oblast` char(15) NOT NULL,
`school` char(15) NOT NULL,
`locale_id` int NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `registration`;
CREATE TABLE `registration` (
`id` int NOT NULL AUTO_INCREMENT,
`entrant_id` int NOT NULL,
`faculty_id` int NOT NULL,
`mg_id` int NOT NULL,
`sg_id` int NOT NULL,
`tg_id` int NOT NULL,
`is_blocked` boolean NOT NULL,
`is_checked` boolean NOT NULL,
`is_budget` boolean NOT NULL,
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `positions`;
CREATE TABLE `positions` (
`id` int NOT NULL AUTO_INCREMENT,
`faculty_id` int NOT NULL,
`pos_quantity` int NOT NULL,
`bud_pos_quantity` int NOT NULL,
`pos_filled` int NOT NULL,
`bud_pos_filled` int NOT NULL,
PRIMARY KEY (`id`)
);
INSERT INTO `locale` VALUES (1,'uk');
INSERT INTO `locale` VALUES (2,'en');
INSERT INTO `locale` VALUES (3,'ru');
INSERT INTO `users` VALUES (1,'admin', 'admin', 'rockarolla6666@gmail.com', 1);
INSERT INTO `users` VALUES (2,'user', 'user', 'rockarolla6666@gmail.com', 2);
INSERT INTO `roles` VALUES (1,'admin');
INSERT INTO `roles` VALUES (2,'user');
|
create database dbo4
default charset utf8;
show databases;
create table t_user (
id int primary key auto_increment,
username varchar(50)
);
|
/*
Navicat MySQL Data Transfer
Source Server : 张强本机mysql
Source Server Version : 50720
Source Host : localhost:3306
Source Database : zqmybatisplus
Target Server Type : MYSQL
Target Server Version : 50720
File Encoding : 65001
Date: 2020-11-17 11:05:52
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for t_users
-- ----------------------------
DROP TABLE IF EXISTS `t_users`;
CREATE TABLE `t_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`age` int(10) DEFAULT NULL,
`bir` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of t_users
-- ----------------------------
INSERT INTO `t_users` VALUES ('1', '1', '1', '2020-11-16 20:36:07');
INSERT INTO `t_users` VALUES ('2', 'ffff反反复复付付付付付付付付', '2', '2020-11-16 13:04:53');
INSERT INTO `t_users` VALUES ('3', 'ffff反反复复付付付付付付付付', '2', '2020-11-16 13:04:53');
INSERT INTO `t_users` VALUES ('4', 'bbbb', '3223', '2020-11-16 13:47:06');
INSERT INTO `t_users` VALUES ('5', 'bbbb', '3223', '2020-11-16 13:47:50');
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `editCustomer`(
IN customername VARCHAR(150),
IN customertypeid INT(11),
IN dateofbirth DATE,
IN mobileno VARCHAR(13),
IN emailaddress VARCHAR(100),
IN modifiedby VARCHAR(100),
IN id INT(11)
)
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
END;
START TRANSACTION;
UPDATE customer SET
customername = customername,
customertypeid = customertypeid,
dateofbirth = dateofbirth,
mobileno = mobileno,
emailaddress = emailaddress,
modifiedby = modifiedby
WHERE customerid = id;
COMMIT;
END |
insert into business_type(name) values
('CTO'),
('shinomantazh'),
('shop'),
('test');
insert into service_type(name, business_type_id) values
('body', (select id from business_type where name like 'CTO')),
('run', (select id from business_type where name like 'CTO')),
('engine', (select id from business_type where name like 'CTO')),
('runnew', (select id from business_type where name like 'shinomantazh')),
('disk', (select id from business_type where name like 'shinomantazh')),
('test', (select id from business_type where name like 'shinomantazh')),
('gum', (select id from business_type where name like 'shinomantazh'));
insert into service(name, service_type_id) values
('straightening dents', (select id from service_type where name like 'body')),
('balancing', (select id from service_type where name like 'run')),
('oil change', (select id from service_type where name like 'engine')),
('straightening discs', (select id from service_type where name like 'disk')),
('rubber change', (select id from service_type where name like 'gum'));
insert into business(phone, address, latitude, longitude, name, business_user_user_details_id) values
('098-123-45-67', 'Kiev', 100, 100, 'user 1 STO 1', (select id from adviser_usr a inner join business_usr b on (a.id = b.user_details_id) where a.email like 'bvg@mail.com')),
('098-123-45-67', 'Kiev', 101, 110, 'user 1 STO 2', (select id from adviser_usr a inner join business_usr b on (a.id = b.user_details_id) where a.email like 'bvg@mail.com')),
('066-666-66-66', 'Kharkov', 102, 120, 'user 2 STO 1', (select id from adviser_usr a inner join business_usr b on (a.id = b.user_details_id) where a.email like 'bkc@mail.com')),
('096-999-99-99', 'Kharkov', 103, 130, 'user 2 STO 2', (select id from adviser_usr a inner join business_usr b on (a.id = b.user_details_id) where a.email like 'bkc@mail.com'));
insert into business_has_service(business_id, service_for_businesses_id)
select b.id, s.id from business b, service s;
insert into work_time(day, from_time, to_time, business_id) values
(0, now(), now(), (select id from business limit 1)),
(1, now(), now(), (select id from business limit 1)),
(2, now(), now(), (select id from business limit 1));
insert into service(name, service_type_id) values
('for-delete-test', (select id from service_type where name like 'disk'));
|
USE classicmodels;
-- PREGUNTA 1
SELECT employeeNumber, lastName, firstName
FROM employees
WHERE firstName LIKE 'a%';
-- PREGUNTA 2
SELECT employeeNumber, lastName, firstName
FROM employees
WHERE firstName LIKE '%on';
-- PREGUNTA 3
SELECT employeeNumber, lastName, firstName
FROM employees
WHERE firstName LIKE '%on%';
-- PREGUNTA 4
SELECT employeeNumber, lastName, firstName
FROM employees
WHERE firstName LIKE 't%m'
AND LENGTH(firstName) = 3;
-- PREGUNTA 5
SELECT employeeNumber, lastName, firstName
FROM employees
WHERE firstName NOT LIKE 'B%';
-- PREGUNTA 6
SELECT productCode, productName
FROM products
WHERE productCode LIKE '%_20%';
-- PREGUNTA 7
SELECT orderNumber, sum(priceEach * quantityOrdered)
FROM orderdetails
GROUP BY orderNumber;
-- PREGUNTA 8
SELECT year(orderDate), count(*)
FROM orders
GROUP BY year(orderDate);
-- PREGUNTA 9
SELECT lastName, firstName
FROM employees
WHERE officeCode
IN (SELECT officeCode FROM offices WHERE country = 'USA');
-- PREGUNTA 10
SELECT customerNumber, checkNumber, amount
FROM payments
WHERE amount IN (SELECT max(amount) FROM payments);
-- PREGUNTA 11
SELECT customerNumber, checkNumber, amount
FROM payments
WHERE amount > (SELECT avg(amount) FROM payments);
-- PREGUNTA 12
SELECT customerName
FROM customers
WHERE customerNumber NOT IN (SELECT customerNumber FROM orders);
-- PREGUNTA 13
SELECT max(unidades_pedidas) AS 'maximo',
min(unidades_pedidas),
avg(unidades_pedidas)
FROM
(SELECT orderNumber, sum(quantityOrdered) AS 'unidades_pedidas'
FROM orderdetails
GROUP BY orderNumber) AS subconsulta;
-- PREGUNTA 14
SELECT count(*) AS 'pedidos_CA'
FROM orders
WHERE customerNumber IN
(SELECT customerNumber
FROM customers
WHERE state = 'CA'); -- No me sale, lo intentaré después. |
/*The purchase funnel is:
Take the Style Quiz → Home Try-On → Purchase the Perfect Pair of Glasses
During the Home Try-On stage, we will be conducting an A/B Test:
50% of the users will get 3 pairs to try on
50% of the users will get 5 pairs to try on
Let’s find out whether or not users who get more pairs to try on
at home will be more likely to make a purchase.
*/
-- What is the number of responses for each question?
SELECT
s.question,
COUNT(*) AS responses
FROM survey AS s
GROUP BY 1;
-- create a table that show all users and their behaviour on every step (either try on or purchase)
SELECT
quiz.user_id,
home_try_on.number_of_pairs,
home_try_on.user_id IS NOT NULL AS 'home_try',
purchase.user_id IS NOT NULL AS 'purchased'
FROM quiz
LEFT JOIN home_try_on
ON quiz.user_id = home_try_on.user_id
LEFT JOIN purchase
ON quiz.user_id = purchase.user_id;
-- compare conversion from quiz→home_try_on and home_try_on→purchase.
SELECT
ROUND(1.0 * COUNT(home_try_on.user_id) / COUNT(quiz.user_id),2) AS 'quiz_to_home_try',
ROUND(1.0 * COUNT(purchase.user_id) / COUNT(home_try_on.user_id),2) AS 'home_try_to_purchase'
FROM quiz
LEFT JOIN home_try_on
ON quiz.user_id = home_try_on.user_id
LEFT JOIN purchase
ON quiz.user_id = purchase.user_id;
-- Let’s find out whether or not users who get more pairs to try on at home will be more likely to make a purchase.
-- calculate the difference in purchase rates between customers who had 3 number_of_pairs with ones who had 5.
WITH TEMP AS
(
SELECT
(
SELECT
1.0 * COUNT(purchase.user_id) / COUNT(home_try_on.user_id) AS 'three_pairs_purchase_rate'
FROM home_try_on
LEFT JOIN purchase
ON home_try_on.user_id = purchase.user_id
WHERE home_try_on.number_of_pairs = '3 pairs'
) AS 'three_pairs_purchase_rates',
(
SELECT
1.0 * COUNT(purchase.user_id) / COUNT(home_try_on.user_id) AS 'five_pairs_purchase_rate'
FROM home_try_on
LEFT JOIN purchase
ON home_try_on.user_id = purchase.user_id
WHERE home_try_on.number_of_pairs = '5 pairs'
) AS 'five_pairs_purchase_rates'
)
SELECT
three_pairs_purchase_rates,
five_pairs_purchase_rates,
CASE
WHEN three_pairs_purchase_rates > five_pairs_purchase_rates THEN 'trying 3 pairs gives better purchase rate'
WHEN three_pairs_purchase_rates < five_pairs_purchase_rates THEN 'trying 5 pairs gives better purchase rate'
ELSE 'DRAW'
END AS 'compare_result'
FROM TEMP;
-- The most common results of the style quiz.
SELECT
quiz.style,
COUNT(*) AS 'total_answers'
FROM quiz
GROUP BY 1
ORDER BY 2 DESC
LIMIT 1;
-- Which is the top selling model ?
SELECT
purchase.model_name,
purchase.style,
COUNT(*) 'purchases'
FROM purchase
GROUP BY 1
ORDER BY 3 DESC
LIMIT 1;
|
-- Your SQL goes here
CREATE TABLE jsonb_test (
id SERIAL PRIMARY KEY,
nullable JSONB,
not_nullable JSONB NOT NULL
);
|
/******** Commonly Used Functions for Time Series ***********/
--------------------- LAG() function ---------------------------
-- to reference rows relative to the currently processed rows.
-- LAG() looks backwards and allows us to compare condition with the previous nth row of current row.
SELECT dept_id, server_id, cpu_utilization,
LAG(cpu_utilization) OVER (PARTITION BY dept_id ORDER BY cpu_utilization DESC)
FROM time_series.vw_utilization
WHERE event_time BETWEEN '2019-03-05' AND '2019-03-06';
-- with offset of 10, looking backwards to previous 10th row from the current one
SELECT dept_id, server_id, cpu_utilization,
LAG(cpu_utilization, 10) OVER (PARTITION BY dept_id ORDER BY cpu_utilization DESC)
FROM time_series.vw_utilization
WHERE event_time BETWEEN '2019-03-05' AND '2019-03-06'; |
-- Usuarios mas populares
create table max_followers_trend (
followers int
);
insert into max_followers_trend (followers)
(select max(u.followers_count)
from app_user u
inner join app_tweet tt on (tt.author_id = u.id)
inner join app_trend at on (at.id = tt.trend_id)
group by tt.trend_id order by at.tweets_count desc limit 10);
select u.screen_name as 'Usuario', u.followers_count as 'Cantidad de seguidores'
from
app_user u
where u.followers_count in (select followers from max_followers_trend);
-- Tweets mas populares
select text as 'Tweet', created_at as 'Fecha 'from app_tweet where retweet_count in (
select max(tt.retweet_count) as 'cant'
from app_tweet tt
group by tt.trend_id order by 'cant' desc ) limit 5;
-- Query de ejemplo Cyfe
SELECT * FROM (SELECT `screen_name` AS `Name`, `followers_count` AS `Followers`
FROM `app_user` WHERE followers_count > 0 ORDER BY `followers_count` DESC) as `tb1`
UNION SELECT 'Color', '#009dee' |
CREATE DEFINER=`root`@`localhost` PROCEDURE `Changer_Afficher_Sinistre`(IN Id_S INT,
IN afficher boolean)
BEGIN
IF afficher THEN
UPDATE sinistres
SET
afficher = 1
WHERE
id = Id_S;
ELSE
UPDATE sinistres
SET
afficher = 0
WHERE
id = Id_S;
END IF;
END |
insert into m_biodata(first_name,last_name) values ('Mulya','Prasetya'); |
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost
-- Tiempo de generación: 07-06-2021 a las 11:24:51
-- Versión del servidor: 5.7.33-0ubuntu0.16.04.1
-- Versión de PHP: 7.4.13
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 */;
--
-- Base de datos: `nmartos_examenuf2uf3`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `failed_jobs`
--
CREATE TABLE `failed_jobs` (
`id` bigint(20) UNSIGNED NOT NULL,
`uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`connection` text COLLATE utf8mb4_unicode_ci NOT NULL,
`queue` text COLLATE utf8mb4_unicode_ci NOT NULL,
`payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `messages`
--
CREATE TABLE `messages` (
`id` bigint(20) UNSIGNED NOT NULL,
`from` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`to` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`messages` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`suma` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `messages`
--
INSERT INTO `messages` (`id`, `from`, `to`, `messages`, `suma`, `created_at`, `updated_at`) VALUES
(1, '12', 'All', '4 + 4', '8', '2021-06-05 00:10:14', '2021-06-05 00:10:14'),
(2, '12', 'All', '3 + 4', '7', '2021-06-05 00:10:16', '2021-06-05 00:10:16'),
(3, '12', 'All', '8 + 9', '17', '2021-06-05 00:10:18', '2021-06-05 00:10:18'),
(4, '12', 'All', '4 + 9', '13', '2021-06-05 00:10:21', '2021-06-05 00:10:21'),
(5, '12', 'All', '6 + 4', '10', '2021-06-05 00:13:49', '2021-06-05 00:13:49'),
(6, '11', 'All', '4 + 9', '13', '2021-06-05 00:14:20', '2021-06-05 00:14:20'),
(7, '11', 'All', '6 + 8', '14', '2021-06-05 00:14:23', '2021-06-05 00:14:23'),
(8, '11', 'All', '4 + 1', '5', '2021-06-05 00:14:25', '2021-06-05 00:14:25'),
(9, '11', 'All', '10 + 9', '19', '2021-06-05 00:14:27', '2021-06-05 00:14:27'),
(10, '11', 'All', '7 + 9', '16', '2021-06-05 00:14:32', '2021-06-05 00:14:32'),
(11, '12', 'All', '10 + 9', '19', '2021-06-05 00:26:16', '2021-06-05 00:26:16'),
(12, '12', 'All', '9 + 3', '12', '2021-06-05 00:28:24', '2021-06-05 00:28:24'),
(13, '12', 'All', '10 + 10', '20', '2021-06-05 00:32:01', '2021-06-05 00:32:01'),
(14, '12', 'All', '9 + 4', '13', '2021-06-05 00:32:53', '2021-06-05 00:32:53'),
(15, '12', 'All', '1 + 7', '8', '2021-06-05 00:33:38', '2021-06-05 00:33:38'),
(16, '12', 'All', '3 + 6', '9', '2021-06-05 00:34:42', '2021-06-05 00:34:42'),
(17, '12', 'All', '1 + 9', '10', '2021-06-05 00:37:07', '2021-06-05 00:37:07'),
(18, '12', 'All', '2 + 9', '11', '2021-06-05 00:37:46', '2021-06-05 00:37:46'),
(19, '12', 'All', '6 + 1', '7', '2021-06-05 00:38:29', '2021-06-05 00:38:29'),
(20, '12', 'All', '5 + 3', '8', '2021-06-05 00:38:43', '2021-06-05 00:38:43'),
(21, '12', 'All', '6 + 5', '11', '2021-06-05 00:39:12', '2021-06-05 00:39:12'),
(22, '12', 'All', '8 + 9', '17', '2021-06-05 00:43:02', '2021-06-05 00:43:02'),
(23, '12', 'All', '4 + 5', '9', '2021-06-05 00:43:48', '2021-06-05 00:43:48'),
(24, '12', 'All', '9 + 9', '18', '2021-06-05 00:56:18', '2021-06-05 00:56:18'),
(25, '12', 'All', '6 + 5', '11', '2021-06-05 01:11:29', '2021-06-05 01:11:29'),
(26, '12', 'All', '7 + 3', '10', '2021-06-05 01:12:11', '2021-06-05 01:12:11'),
(27, '12', 'All', '2 + 3', '5', '2021-06-05 01:12:57', '2021-06-05 01:12:57'),
(28, '12', 'All', '1 + 4', '5', '2021-06-05 01:14:11', '2021-06-05 01:14:11'),
(29, '12', 'All', '10 + 7', '17', '2021-06-05 01:17:07', '2021-06-05 01:17:07'),
(30, '12', 'All', '6 + 7', '13', '2021-06-05 01:17:39', '2021-06-05 01:17:39'),
(31, '12', 'All', '5 + 4', '9', '2021-06-05 01:20:10', '2021-06-05 01:20:10'),
(32, '12', 'All', '10 + 7', '17', '2021-06-05 11:55:11', '2021-06-05 11:55:11'),
(33, '12', 'All', '4 + 3', '7', '2021-06-05 11:55:14', '2021-06-05 11:55:14'),
(34, '12', 'All', '6 + 1', '7', '2021-06-05 11:55:16', '2021-06-05 11:55:16'),
(35, '12', 'All', '5 + 7', '12', '2021-06-05 11:55:17', '2021-06-05 11:55:17'),
(36, '12', 'All', '6 + 8', '14', '2021-06-05 11:55:18', '2021-06-05 11:55:18'),
(37, '12', 'All', '1 + 8', '9', '2021-06-05 11:55:19', '2021-06-05 11:55:19'),
(38, '12', 'All', '9 + 4', '13', '2021-06-05 11:55:20', '2021-06-05 11:55:20'),
(39, '12', 'All', '6 + 3', '9', '2021-06-05 11:55:27', '2021-06-05 11:55:27'),
(40, '12', 'All', '5 + 2', '7', '2021-06-05 12:08:07', '2021-06-05 12:08:07'),
(41, '12', 'All', '9 + 9', '18', '2021-06-05 12:09:22', '2021-06-05 12:09:22'),
(42, '12', 'All', '1 + 1', '2', '2021-06-05 12:11:02', '2021-06-05 12:11:02'),
(43, '12', 'All', '2 + 4', '6', '2021-06-05 12:16:40', '2021-06-05 12:16:40'),
(44, '12', 'All', '10 + 5', '15', '2021-06-05 12:18:33', '2021-06-05 12:18:33'),
(45, '12', 'All', '4 + 9', '13', '2021-06-05 12:18:43', '2021-06-05 12:18:43'),
(46, '12', 'All', '2 + 1', '3', '2021-06-06 08:21:08', '2021-06-06 08:21:08'),
(47, '12', 'All', '4 + 6', '10', '2021-06-06 08:21:10', '2021-06-06 08:21:10'),
(48, '12', 'All', '8 + 1', '9', '2021-06-06 08:21:12', '2021-06-06 08:21:12'),
(49, '12', 'All', '9 + 5', '14', '2021-06-06 08:21:27', '2021-06-06 08:21:27'),
(50, '12', 'All', '3 + 10', '13', '2021-06-06 08:36:08', '2021-06-06 08:36:08'),
(51, '12', 'All', '3 + 2', '5', '2021-06-06 08:52:38', '2021-06-06 08:52:38'),
(52, '12', 'All', '2 + 1', '3', '2021-06-06 09:00:34', '2021-06-06 09:00:34'),
(53, '12', 'All', '10 + 4', '14', '2021-06-07 00:19:38', '2021-06-07 00:19:38');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2019_08_19_000000_create_failed_jobs_table', 1),
(4, '2021_06_04_134457_create_messages_table', 2);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `password_resets`
--
INSERT INTO `password_resets` (`email`, `token`, `created_at`) VALUES
('noeliamartos2001@gmail.com', '$2y$10$yCAZ3vd7XGjNLzc3D/.xku.jEVyyqjY/.fUxAbPx/BXrtzigz44HG', '2021-06-02 07:27:56');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`cognoms` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT 'Cognoms',
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`imagen` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`admin` int(11) NOT NULL DEFAULT '0',
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `name`, `cognoms`, `email`, `imagen`, `admin`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(5, 'Noe', 'Martos', 'noeliamartos@gmail.com', NULL, 1, NULL, '$2y$10$xWDXIVcBxj4x8/WV/nLAVeyuLxdytQWJb.k5fUTX4DbRzPTSt495O', NULL, '2021-06-03 13:26:37', '2021-06-03 13:26:37'),
(6, 'Noelia', 'Martos Garcia', '2@gmail.com', 'public/image.JPG', 0, NULL, '$2y$10$ETJ5RWAJei0nk1km2Spjq.bMMSpEfOklp3KuhcEHFp5yViyznxrWe', 'y8FOMumirdb0gr4cI5wvWtOMQU4C6uxCHAXW0JiZgCtfpoCNej98JN2jgp4O', '2021-06-03 15:01:41', '2021-06-03 15:01:41'),
(12, 'admin', 'Cognoms', 'admin@gmail.com', 'public/image.JPG', 1, NULL, '$2y$10$xWDXIVcBxj4x8/WV/nLAVeyuLxdytQWJb.k5fUTX4DbRzPTSt495O', 'yLJXm9juEnMqtAYJZ0UBSeaY0n1M5GKl5RsQbdMh2XFUL90T04lybLfoKiKX', '2021-06-04 23:27:22', '2021-06-04 23:27:22'),
(14, 'test', 'Cognoms', 'test@gmail.com', 'public/image.JPG', 0, NULL, '$2y$10$khvH.Bnkp2w1dymc5wueS.g4ltxhURKxnue4VT82/Cyg/upXravBK', NULL, '2021-06-06 09:21:24', '2021-06-06 09:21:24'),
(15, 'Noelia', 'Martos', 'noeliamartos2001@gmail.com', NULL, 1, NULL, '$2y$10$6c.00.8f6tw48yTViu1ikua6g6A1USDJ5wec2zHULhpFzXdTOqU9i', NULL, '2021-06-06 09:23:18', '2021-06-06 09:23:18'),
(16, 'Noadmin', 'Cognoms', 'no@gmail.com', NULL, 0, NULL, '$2y$10$iD1R2y.lnauQ8WflMFIy5exR9jmtF2ZpfUmBJEmxdesYyw5MAPLXK', NULL, '2021-06-07 00:18:14', '2021-06-07 00:18:14');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `failed_jobs`
--
ALTER TABLE `failed_jobs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`);
--
-- Indices de la tabla `messages`
--
ALTER TABLE `messages`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `failed_jobs`
--
ALTER TABLE `failed_jobs`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `messages`
--
ALTER TABLE `messages`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=54;
--
-- AUTO_INCREMENT de la tabla `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
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 */;
|
create database if not exists game;
use game;
create table if not exists user(
id int(11) not null auto_increment,
name varchar(255) not null default '',
gold int(11) not null default 0,
exp int(11) not null default 0,
diamond int(11) not null default 0,
vip_level int(11) not null default 0,
player_level int(11) not null default 1,
avatar varchar(255) not null default '',
mobile varchar(20) not null default '',
passwd varchar(255) not null default '',
fbtoken varchar(255) not null default '',
total_betting int(11) not null default 0,
total_game int(11) not null default 0,
last_recharge_time
created_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
primary key (id), unique key(`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table if not exists game_settings(
id int(11) not null auto_increment,
`key` varchar(255) not null default '',
description varchar(255) not null default '',
created_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
primary key (id) ,unique key(`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table if not exists vip_increase_table(
id int(11) not null auto_increment,
vip_level varchar(255) not null default '',
description varchar(255) not null default '',
need_exp int(11) not null default 999999,
vip_func varchar(255) not null default '',
created_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
primary key (id),unique key(`vip_level`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table if not exists shop_items(
id int(11) not null auto_increment,
item_name varchar(255) not null default '',
description varchar(255) not null default '',
money int(11) not null default 999999,
discount varchar(255) not null default '',
item_func varchar(255) not null default '',
created_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
primary key (id),unique key(`item_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table if not exists mail(
id int(11) not null auto_increment,
mail_type int(11) not null default 0,
mail_param varchar(255) not null default '',
title varchar(255) not null default '',
content text not null,
attach_gold int(11) not null default 0,
attach_exp int(11) not null default 0,
attach_diamond int(11) not null default 0,
attach_item varchar(255) not null default 0,
created_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table if not exists exp(
id int(11) not null auto_increment,
need_exp int(11) not null default 0,
present varchar(255) not null default '',
created_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
primary key(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
insert into user (user_id, username, password, first_name, last_name, email) values
(1, 'csr_admin', '$2y$12$Je2nx4NYYQnZfUFqeEfWAekNwg0qBs1sZKA4ay70Ea39dItCxw6wW', 'admin', 'admin', 'admin@travel.com'),
(2, 'csr_tom', '$2y$12$mMgV9eakGVSZ3IxeSW7CR.5NrDmrvnqtsBzfz7uwZZU2PRJFa4L6a', 'Tom', 'Miles', 'tom.cook@travel.com'),
(3, 'jacky', '$2y$12$YkOfpb0hweNwYy3F2cQU4O0y7ZgH2JtfxtIcdj7Sd7lYraajutsey', 'Jacky', 'Huges', 'jacky.huges@travel.com');
insert into auth_user_group (auth_user_group_id, auth_group, description) values
(1, 'CSR_ADMIN', 'CSR Administrator group access'),
(2, 'CSR_USER', 'CSR User group access'),
(3, 'VIEWER', 'Viewer has only viewing access');
insert into user_auth_user_group (username, auth_user_group_id) values
('csr_admin', 1),
('csr_tom', 2),
('jacky', 3);
|
BEGIN TRANSACTION;
UPDATE ref_quota
SET cpu_requests = 16, cpu_limits = 32
WHERE id = 'large';
END TRANSACTION;
|
SELECT product_title, product_cat
FROM products p
INNER JOIN categories c
ON p.product_cat=c.cat_id; |
-- jfdkf sfsdf sdfdsf sdfsdfs
CREATE TABLE IF NOT EXISTS unique_id(id NOT UNIQUE DEFAULT 1, name VARCHAR(@%^));
|
create or replace view v_zb003_cd as
(--用于至表单选择通知书。
select JSDE103,
JSDE104,
JSDE931,
DE156,
CZDE951,
CZDE181,
DE186,
DE062,
DE042,
DE084,
CZDE119,
JSDE802,
JSDE118,
JSDE108,
DE151 AS TZSBH,
CZDE182,
JSDE901,
CZDE901,
DE001,
JSDE909,
JSDE007,
JSDE008,
JSDE009,
JSDE028,
JSDE029,
JSDE940,
JSDE999,
JSDE983,
JSDE984,
JSDE041,
CZDE016,
JSDE011,
JSDE012,
CZDE183,
CZDE015,
JSDE117,
CZDE938,
DE011,
CZDE188,
CZDE189,
DE022,
DE181 - HFJE AS TZSJE,
SYJE,
TZJE,
ZTSYJE,
KYJE-nvl((select n1 from temp_data_hd where c1=z.jsde104),0) KYJE
from v_zb003 z
where nvl(jsde011, 0) in (0, 2)
and jsde940 >= '88'
)
;
|
-- phpMyAdmin SQL Dump
-- version 5.0.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 30 Sep 2021 pada 21.34
-- Versi server: 10.4.16-MariaDB
-- Versi PHP: 7.4.12
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: `aerator`
--
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_log`
--
CREATE TABLE `tb_log` (
`id` int(11) NOT NULL,
`date` datetime NOT NULL,
`value` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Struktur dari tabel `tb_status`
--
CREATE TABLE `tb_status` (
`id` int(11) NOT NULL,
`status` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data untuk tabel `tb_status`
--
INSERT INTO `tb_status` (`id`, `status`) VALUES
(1, '0');
--
-- Indexes for dumped tables
--
--
-- Indeks untuk tabel `tb_log`
--
ALTER TABLE `tb_log`
ADD PRIMARY KEY (`id`);
--
-- Indeks untuk tabel `tb_status`
--
ALTER TABLE `tb_status`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT untuk tabel yang dibuang
--
--
-- AUTO_INCREMENT untuk tabel `tb_log`
--
ALTER TABLE `tb_log`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT untuk tabel `tb_status`
--
ALTER TABLE `tb_status`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
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 */;
|
-- Paired Margaret & Aja
-- DEFINE YOUR DATABASE SCHEMA HERE
DROP TABLE IF EXISTS sales, customers, employees CASCADE;
CREATE TABLE customers (
id SERIAL PRIMARY KEY,
customer_name varchar(100) NOT NULL,
account_no varchar(100) NOT NULL
);
CREATE TABLE employees (
id SERIAL PRIMARY KEY,
employee_name varchar(100) NOT NULL,
employee_email varchar(50) NOT NULL
);
CREATE TABLE sales (
id SERIAL PRIMARY KEY,
invoice_no int NOT NULL,
sale_date varchar(100) NOT NULL,
product_name varchar(100) NOT NULL,
units_sold int NOT NULL,
sale_amount varchar(100) NOT NULL,
invoice_frequency varchar(100) NOT NULL,
customer_id SERIAL NOT NULL REFERENCES customers,
employee_id SERIAL NOT NULL REFERENCES employees
);
-- Ways to view the entire linked table
-- SELECT *
-- FROM sales
-- JOIN customers ON sales.customer_id = customers.id
-- JOIN employees ON sales.employee_id = employees.id;
-- SELECT * FROM sales JOIN customers ON sales.customer_id = customers.id;
-- SELECT * FROM sales JOIN employees ON sales.employee_id = employees.id;
-- SELECT * FROM sales JOIN customers ON sales.customer_id = customers.id JOIN employees ON sales.employee_id = employees.id;
|
create or replace trigger check_date after
INSERT on reservation
FOR EACH ROW
DECLARE
checkIn reservation.resv_checkin%TYPE;
user_date_error EXCEPTION;
BEGIN
checkIn := :new.resv_checkin;
IF checkIn < SYSDATE THEN
RAISE user_date_error;
ELSE
DBMS_OUTPUT.PUT_LINE('예약을 환영합니다');
END IF;
EXCEPTION
WHEN user_date_error THEN
RAISE_APPLICATION_ERROR(-20001, '날짜오류');
END;
|
-- --------------------------------------------------------
-- Host: localhost
-- Server version: 10.5.9-MariaDB - mariadb.org binary distribution
-- Server OS: Win64
-- HeidiSQL Version: 11.0.0.5919
-- --------------------------------------------------------
/*!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 structure for table electroway.car
CREATE TABLE IF NOT EXISTS `car` (
`id` bigint(20) NOT NULL,
`model` varchar(255) NOT NULL,
`year` bigint(20) NOT NULL,
`battery_capacity` double NOT NULL,
`charging_capacity` double NOT NULL,
`vehicle_max_speed` bigint(20) NOT NULL,
`auxiliary_kwh` double NOT NULL,
`owner_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `owner_id` (`owner_id`),
CONSTRAINT `car_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.car_sequence
CREATE TABLE IF NOT EXISTS `car_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.charging_plug
CREATE TABLE IF NOT EXISTS `charging_plug` (
`id` bigint(20) NOT NULL,
`status` tinyint(4) NOT NULL,
`connector_type` varchar(255) NOT NULL,
`price_kw` double NOT NULL,
`charging_speed_kw` double NOT NULL,
`charging_point_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `charging_point_id` (`charging_point_id`),
CONSTRAINT `charging_plug_ibfk_1` FOREIGN KEY (`charging_point_id`) REFERENCES `charging_point` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.charging_plug_sequence
CREATE TABLE IF NOT EXISTS `charging_plug_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.charging_point
CREATE TABLE IF NOT EXISTS `charging_point` (
`id` bigint(20) NOT NULL,
`station_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `station_id` (`station_id`),
CONSTRAINT `charging_point_ibfk_1` FOREIGN KEY (`station_id`) REFERENCES `station` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.charging_point_sequence
CREATE TABLE IF NOT EXISTS `charging_point_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.consumption
CREATE TABLE IF NOT EXISTS `consumption` (
`id` bigint(20) NOT NULL,
`speed` bigint(20) NOT NULL,
`consumption_kwh` double NOT NULL,
`car_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `car_id` (`car_id`),
CONSTRAINT `consumption_ibfk_1` FOREIGN KEY (`car_id`) REFERENCES `car` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.consumption_sequence
CREATE TABLE IF NOT EXISTS `consumption_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.favourite
CREATE TABLE IF NOT EXISTS `favourite` (
`id` bigint(20) NOT NULL,
`user_id` bigint(20) DEFAULT NULL,
`station_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `station_id` (`station_id`),
CONSTRAINT `favourite_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `favourite_ibfk_2` FOREIGN KEY (`station_id`) REFERENCES `station` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.favourite_sequence
CREATE TABLE IF NOT EXISTS `favourite_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.password_reset_token
CREATE TABLE IF NOT EXISTS `password_reset_token` (
`id` bigint(11) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`token` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.paypal_detail
CREATE TABLE IF NOT EXISTS `paypal_detail` (
`owner_id` bigint(20) NOT NULL,
`client_id` varchar(255) NOT NULL,
`secret` varchar(255) NOT NULL,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`),
UNIQUE KEY `paypal_detail_owner_id_uindex` (`owner_id`),
CONSTRAINT `paypal_detail_user_id_fk` FOREIGN KEY (`owner_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.plug_type
CREATE TABLE IF NOT EXISTS `plug_type` (
`id` bigint(20) NOT NULL,
`plug_type` varchar(255) NOT NULL,
`car_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `car_plug_type_ibfk_1` (`car_id`),
CONSTRAINT `car_plug_type_ibfk_1` FOREIGN KEY (`car_id`) REFERENCES `car` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.plug_type_sequence
CREATE TABLE IF NOT EXISTS `plug_type_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.privilege
CREATE TABLE IF NOT EXISTS `privilege` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.report
CREATE TABLE IF NOT EXISTS `report` (
`id` bigint(20) NOT NULL,
`text_report` varchar(255) NOT NULL,
`user_id` bigint(20) DEFAULT NULL,
`station_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `station_id` (`station_id`),
CONSTRAINT `report_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `report_ibfk_2` FOREIGN KEY (`station_id`) REFERENCES `station` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.report_sequence
CREATE TABLE IF NOT EXISTS `report_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.review
CREATE TABLE IF NOT EXISTS `review` (
`id` bigint(20) NOT NULL,
`text_review` varchar(255) NOT NULL,
`rating` tinyint(4) NOT NULL,
`user_id` bigint(20) DEFAULT NULL,
`station_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `station_id` (`station_id`),
CONSTRAINT `review_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `review_ibfk_2` FOREIGN KEY (`station_id`) REFERENCES `station` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.review_sequence
CREATE TABLE IF NOT EXISTS `review_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.role
CREATE TABLE IF NOT EXISTS `role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.role_privilege
CREATE TABLE IF NOT EXISTS `role_privilege` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`role_id` bigint(20) DEFAULT NULL,
`privilege_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `role_id` (`role_id`),
KEY `privilege_id` (`privilege_id`),
CONSTRAINT `role_privilege_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`),
CONSTRAINT `role_privilege_ibfk_2` FOREIGN KEY (`privilege_id`) REFERENCES `privilege` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.station
CREATE TABLE IF NOT EXISTS `station` (
`id` bigint(20) NOT NULL,
`address` varchar(255) NOT NULL,
`map_latitude_location` double NOT NULL,
`map_longitude_location` double NOT NULL,
`owner_id` bigint(20) DEFAULT NULL,
`description` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `map_latitude_location` (`map_latitude_location`,`map_longitude_location`,`owner_id`),
KEY `owner_id` (`owner_id`),
CONSTRAINT `station_ibfk_1` FOREIGN KEY (`owner_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.station_sequence
CREATE TABLE IF NOT EXISTS `station_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.template_car
CREATE TABLE IF NOT EXISTS `template_car` (
`id` bigint(20) NOT NULL,
`model` varchar(255) NOT NULL,
`year` bigint(20) NOT NULL,
`battery_capacity` double NOT NULL,
`charging_capacity` double NOT NULL,
`plug_type` varchar(255) NOT NULL,
`vehicle_max_speed` bigint(20) NOT NULL,
`auxiliary_kwh` double NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.template_car_sequence
CREATE TABLE IF NOT EXISTS `template_car_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.user
CREATE TABLE IF NOT EXISTS `user` (
`id` bigint(20) NOT NULL,
`user_name` varchar(255) NOT NULL,
`password_hash` varchar(255) NOT NULL,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
`phone_number` varchar(255) DEFAULT NULL,
`email_address` varchar(255) NOT NULL,
`address1` varchar(255) DEFAULT NULL,
`address2` varchar(255) DEFAULT NULL,
`city` varchar(255) DEFAULT NULL,
`region` varchar(255) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL,
`zipcode` varchar(255) DEFAULT NULL,
`is_enabled` tinyint(1) NOT NULL,
`password_reset_token` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_name` (`user_name`),
UNIQUE KEY `email_address` (`email_address`),
UNIQUE KEY `phone_number` (`phone_number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.user_role
CREATE TABLE IF NOT EXISTS `user_role` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`role_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `role_id` (`role_id`),
CONSTRAINT `user_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`),
CONSTRAINT `user_role_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.user_sequence
CREATE TABLE IF NOT EXISTS `user_sequence` (
`next_not_cached_value` bigint(21) NOT NULL,
`minimum_value` bigint(21) NOT NULL,
`maximum_value` bigint(21) NOT NULL,
`start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
`increment` bigint(21) NOT NULL COMMENT 'increment value',
`cache_size` bigint(21) unsigned NOT NULL,
`cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
`cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
) ENGINE=InnoDB SEQUENCE=1;
-- Data exporting was unselected.
-- Dumping structure for table electroway.verification_token
CREATE TABLE IF NOT EXISTS `verification_token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) DEFAULT NULL,
`token` varchar(255) DEFAULT NULL,
`expiry_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT `verification_token_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1;
-- Data exporting was unselected.
/*!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 */;
|
/* insert transaction status */
INSERT INTO payment.transactionstatus
SELECT * FROM (SELECT 1, 'pending') a
WHERE NOT EXISTS (
SELECT * FROM payment.transactionstatus
WHERE status = 1 AND name = 'pending');
INSERT INTO payment.transactionstatus
SELECT * FROM (SELECT 2, 'cancelled') a
WHERE NOT EXISTS (
SELECT * FROM payment.transactionstatus
WHERE status = 2 AND name = 'cancelled');
INSERT INTO payment.transactionstatus
SELECT * FROM (SELECT 3, 'failed') a
WHERE NOT EXISTS (
SELECT * FROM payment.transactionstatus
WHERE status = 3 AND name = 'failed');
INSERT INTO payment.transactionstatus
SELECT * FROM (SELECT 4, 'approved') a
WHERE NOT EXISTS (
SELECT * FROM payment.transactionstatus
WHERE status = 4 AND name = 'approved');
/* insert frequency*/
INSERT INTO payment.paymentsFrequency
SELECT * FROM (SELECT 0, 'any') a
WHERE NOT EXISTS (
SELECT * FROM payment.paymentsFrequency
WHERE frequencyId = 0 AND name = 'any');
INSERT INTO payment.paymentsFrequency
SELECT * FROM (SELECT 1, 'monthly') a
WHERE NOT EXISTS (
SELECT * FROM payment.paymentsFrequency
WHERE frequencyId = 1 AND name = 'monthly');
INSERT INTO payment.paymentsFrequency
SELECT * FROM (SELECT 2, 'yearly') a
WHERE NOT EXISTS (
SELECT * FROM payment.paymentsFrequency
WHERE frequencyId = 2 AND name = 'yearly');
INSERT INTO payment.paymentsFrequency
SELECT * FROM (SELECT 3, 'once') a
WHERE NOT EXISTS (
SELECT * FROM payment.paymentsFrequency
WHERE frequencyId = 3 AND name = 'once');
/* insert payment setting */
INSERT INTO payment.paymentssettings
SELECT * FROM (SELECT 1, '82223', '1.6') a
WHERE NOT EXISTS (
SELECT * FROM payment.paymentssettings
WHERE paymentSettingsId = 1);
/* insert payment types */
INSERT INTO payment.paymenttypes
SELECT * FROM (SELECT 1, 'buy', 'Direct payment with money') a
WHERE NOT EXISTS (
SELECT * FROM payment.paymenttypes
WHERE paymentTypeId = 1);
INSERT INTO payment.paymenttypes
SELECT * FROM (SELECT 2, 'pay', 'Pay with money or CB') a
WHERE NOT EXISTS (
SELECT * FROM payment.paymenttypes
WHERE paymentTypeId = 2);
INSERT INTO payment.paymenttypes
SELECT * FROM (SELECT 3, 'free', 'Free gift from admin or etc') a
WHERE NOT EXISTS (
SELECT * FROM payment.paymenttypes
WHERE paymentTypeId = 3);
/*insert transaction types*/
INSERT INTO payment.transactiontypes
SELECT * FROM (SELECT 1, 'direct') a
WHERE NOT EXISTS (
SELECT * FROM payment.transactiontypes
WHERE transactionTypeId = 1);
INSERT INTO payment.transactiontypes
SELECT * FROM (SELECT 2, 'clubby') a
WHERE NOT EXISTS (
SELECT * FROM payment.transactiontypes
WHERE transactionTypeId = 2);
INSERT INTO payment.transactiontypes
SELECT * FROM (SELECT 3, 'free') a
WHERE NOT EXISTS (
SELECT * FROM payment.transactiontypes
WHERE transactionTypeId = 3);
/* insert payments*/
INSERT INTO payment.payments
SELECT * FROM (SELECT 1, 1,'EUR', 'Yearly membership payment', 1, true, true, 2) a
WHERE NOT EXISTS (
SELECT * FROM payment.payments
WHERE paymentId = 1);
INSERT INTO payment.payments
SELECT * FROM (SELECT 2, 2,'EUR', 'Buy clubby coins', 1, true, false, 0) a
WHERE NOT EXISTS (
SELECT * FROM payment.payments
WHERE paymentId = 2);
INSERT INTO payment.payments
SELECT * FROM (SELECT 4, 3, 'EUR', '10 CB gift', 1, true, false, 0) a
WHERE NOT EXISTS (
SELECT * FROM payment.payments
WHERE paymentId = 4);
INSERT INTO payment.payments
SELECT * FROM (SELECT 5, 2,'EUR', 'Buy clubby coins', 1, true, false, 0) a
WHERE NOT EXISTS (
SELECT * FROM payment.payments
WHERE paymentId = 5);
INSERT INTO payment.lineitems
SELECT * FROM (SELECT nextval('payment.lineitems_id_seq'),'Membership payment', 10000, 1, 1) a
WHERE NOT EXISTS (
SELECT * FROM payment.lineitems
WHERE payment_id = 1);
INSERT INTO payment.lineitems
SELECT * FROM (SELECT nextval('payment.lineitems_id_seq'),'Buy clubby coins', 10000, 1, 2) a
WHERE NOT EXISTS (
SELECT * FROM payment.lineitems
WHERE payment_id = 2);
INSERT INTO payment.lineitems
SELECT * FROM (SELECT nextval('payment.lineitems_id_seq'),'Gift', 1000, 1, 4) a
WHERE NOT EXISTS (
SELECT * FROM payment.lineitems
WHERE payment_id = 4);
INSERT INTO payment.lineitems
SELECT * FROM (SELECT nextval('payment.lineitems_id_seq'),'Buy clubby coins', 100000, 1, 5) a
WHERE NOT EXISTS (
SELECT * FROM payment.lineitems
WHERE payment_id = 5); |
-- phpMyAdmin SQL Dump
-- version 4.4.12
-- http://www.phpmyadmin.net
--
-- Client : 127.0.0.1
-- Généré le : Mer 07 Octobre 2015 à 14:22
-- Version du serveur : 5.6.25
-- Version de PHP : 5.6.11
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 : `webforce3`
--
-- --------------------------------------------------------
--
-- Structure de la table `ecole`
--
CREATE TABLE IF NOT EXISTS `ecole` (
`Id_Ecole` int(5) unsigned NOT NULL,
`nom` varchar(20) NOT NULL
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='Listes des écoles';
--
-- Contenu de la table `ecole`
--
INSERT INTO `ecole` (`Id_Ecole`, `nom`) VALUES
(1, 'Hirson'),
(3, 'Paris');
--
-- Index pour les tables exportées
--
--
-- Index pour la table `ecole`
--
ALTER TABLE `ecole`
ADD PRIMARY KEY (`Id_Ecole`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `ecole`
--
ALTER TABLE `ecole`
MODIFY `Id_Ecole` int(5) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
/*!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 */;
|
-- phpMyAdmin SQL Dump
-- version 4.1.4
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: 27-Mar-2015 às 16:07
-- Versão do servidor: 5.6.15-log
-- PHP Version: 5.4.24
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: `chat`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `codigo`
--
CREATE TABLE IF NOT EXISTS `codigo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`codigo` varchar(255) NOT NULL,
`data` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Extraindo dados da tabela `codigo`
--
INSERT INTO `codigo` (`id`, `codigo`, `data`) VALUES
(3, 'ZGhvY2FvQDY2Ni5jb20=', '2015-02-06 16:21:44');
-- --------------------------------------------------------
--
-- Estrutura da tabela `mensagens`
--
CREATE TABLE IF NOT EXISTS `mensagens` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_de` int(11) NOT NULL,
`id_para` int(11) NOT NULL,
`mensagem` varchar(255) NOT NULL,
`data` datetime NOT NULL,
`lido` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
--
-- Extraindo dados da tabela `mensagens`
--
INSERT INTO `mensagens` (`id`, `id_de`, `id_para`, `mensagem`, `data`, `lido`) VALUES
(1, 3, 1, 'oi bunitão', '2014-11-25 14:19:16', 1),
(2, 1, 2, 'vai da o xerecão!!!', '2014-11-26 08:58:20', 1),
(3, 1, 2, 'diz ai ', '2014-11-26 09:00:32', 1),
(4, 1, 3, 'kde a hora ?', '2014-11-26 09:01:07', 0),
(5, 1, 2, 'kde os horario', '2014-11-26 09:03:01', 1),
(6, 1, 3, 'e ai ', '2014-11-26 09:08:53', 0),
(7, 1, 3, 'oi', '2014-11-26 09:09:41', 0),
(8, 1, 3, 'uuuu', '2014-11-26 09:11:54', 0),
(9, 1, 3, '666666', '2014-11-26 09:12:25', 0),
(10, 1, 3, 'e AI', '2014-11-26 09:12:34', 0),
(11, 2, 1, 'oi', '2014-11-26 09:13:30', 1),
(12, 1, 2, 'oi ee aaaaa<br />sjsjdjdhjdhdd<br />jdhdjhdhdjdhdd <br />sdhdsddjlkjlkadjla', '2014-11-26 09:19:11', 1),
(13, 1, 2, 'diz ai ', '2014-11-26 15:02:26', 1),
(14, 1, 3, 'e', '2014-11-26 15:18:47', 0),
(15, 1, 3, 'oi', '2014-11-26 15:21:23', 0),
(16, 1, 2, 'oi', '2014-11-26 15:23:52', 1),
(17, 1, 3, 'diz ai mah ', '2014-11-27 20:45:07', 0);
-- --------------------------------------------------------
--
-- Estrutura da tabela `usuario`
--
CREATE TABLE IF NOT EXISTS `usuario` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome_final` varchar(255) DEFAULT NULL,
`nome` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`senha` varchar(255) DEFAULT NULL,
`perda` int(11) DEFAULT NULL,
`horario` datetime NOT NULL,
`limite` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Extraindo dados da tabela `usuario`
--
INSERT INTO `usuario` (`id`, `nome_final`, `nome`, `email`, `senha`, `perda`, `horario`, `limite`) VALUES
(1, '1416932140.jpg', 'MaurÃcio S. PorfÃrio', 'porfirio@souza.msp', 'roxeda', 0, '2015-01-27 23:18:17', '2015-01-27 23:28:30'),
(2, '1416932171.jpg', 'Dhonata Freitas', 'dhocao@666.com', '666', 1, '2015-01-01 20:34:18', '2015-01-01 20:35:49'),
(3, '1416932310.jpg', 'Fabio Sousa', 'fabiofisico@bol.com.br', 'amor1988', 0, '2014-11-25 17:18:55', '2014-11-25 17:20:25');
-- --------------------------------------------------------
--
-- Estrutura da tabela `va_posts`
--
CREATE TABLE IF NOT EXISTS `va_posts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`autor` int(11) NOT NULL,
`conteudo` text NOT NULL,
`data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`status` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Extraindo dados da tabela `va_posts`
--
INSERT INTO `va_posts` (`id`, `autor`, `conteudo`, `data`, `status`) VALUES
(1, 1, 'Diz ai pvt', '2014-11-25 15:21:36', 0),
(2, 1, 'oi povo', '2014-11-27 21:45:28', 0),
(3, 1, 'ta paradão isso aq view kkkk!!!', '2015-01-27 21:22:17', 0);
/*!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 */;
|
CREATE OR REPLACE PROCEDURE valideAge(profil VARCHAR2, jeu VARCHAR2) IS
dateJoueur DATE;
pegiJeu VARCHAR2(30);
CURSOR cJoueur IS SELECT date_naissance FROM joueur WHERE joueur.login=profil;
CURSOR cPegi IS SELECT pegi FROM jeu WHERE jeu.titre=jeu;
BEGIN
OPEN cPegi;
OPEN cJoueur;
FETCH cPegi INTO pegiJeu;
FETCH cJoueur INTO dateJoueur;
IF (trouverAge(dateJoueur) >= pegiJeu) THEN
DBMS_OUTPUT.PUT_LINE( profil ||' peut acheter ' || jeu ||', il est assez grand ;)');
ELSE
DBMS_OUTPUT.PUT_LINE( profil ||' ne peut pas acheter ' || jeu ||', il est encore un peu jeune ;)');
END IF;
CLOSE cPegi;
CLOSE cJoueur;
END;
/
--IS/AS?
CREATE OR REPLACE PROCEDURE Abo(log VARCHAR2) AS
--login_user VARCHAR2(50);
abonnement VARCHAR2(50);
--CURSOR cursorLog IS SELECT login_user FROM Utilisateur WHERE Utilisateur.login_user=log;
CURSOR cursorAbo IS SELECT type_abonnement FROM Utilisateur WHERE Utilsateur.type_abonnement=abo;
BEGIN
OPEN cursorLog;
OPEN cursorAbo;
--FETCH cursorLog INTO login_user;
FETCH cursorAbo INTO abonnement;
IF (abonnement ='Inactif') THEN
DBMS_OUTPUT.PUT_LINE( log ||' ne possède plus d abonnement valide');
ELSE
DBMS_OUTPUT.PUT_LINE( log ||' dispose de l abonnement: ');
END IF;
END ;
|
DELIMITER $$
DROP VIEW IF EXISTS `flat_school_user`$$
CREATE ALGORITHM=UNDEFINED SQL SECURITY DEFINER VIEW `flat_school_user` AS (
SELECT
`su`.`id` AS `userId`,
`su`.`uid` AS `uid`,
`sc1`.`id` AS `schoolId`,
`sc1`.`name` AS `schoolName`
FROM ((`sys_user` `su`
JOIN `sys_office` `sc`)
JOIN `sys_office` `sc1`)
WHERE ((`su`.`company_id` = `sc`.`id`)
AND ((`sc`.`id` = `sc1`.`id`)
OR (LOCATE(`sc1`.`id`,`sc`.`parent_ids`) > 0))))$$
DELIMITER ; |
SELECT * FROM Timestamp_test_from;
|
DROP TABLE IF EXISTS AGGREGATE_tract_{{ decade }};
SELECT
YEARLY_devdb_{{ decade }}.bct{{ decade }}::TEXT,
SUM(comp2010ap) as comp2010ap,
{%- for year in years %}
SUM(comp{{ year }}) as comp{{year}},
{% endfor %}
-- SUM(since_cen10) as since_cen10,
SUM(filed) as filed,
SUM(approved) as approved,
SUM(permitted) as permitted,
SUM(withdrawn) as withdrawn,
SUM(inactive) as inactive
-- {% if decade == '2010' %}
-- ,SUM(CENSUS_by_tract.cenunits10) as cenunits10
-- ,SUM(COALESCE(YEARLY_devdb_{{ decade }}.since_cen10, 0) + COALESCE(CENSUS_by_tract.cenunits10, 0)) as total
-- ,SUM(census_units10adj.adjunits10) as adjunits10
-- ,SUM(COALESCE(YEARLY_devdb_{{ decade }}.since_cen10, 0) + COALESCE(census_units10adj.adjunits10, 0)) as totaladj
-- {% endif %}
INTO AGGREGATE_tract_{{ decade }}
FROM YEARLY_devdb_{{ decade }}
-- {% if decade == '2010' %}
-- LEFT JOIN (
-- SELECT centract10, SUM(cenunits10) as cenunits10
-- FROM census_units10
-- GROUP BY centract10
-- ) CENSUS_by_tract
-- ON YEARLY_devdb_{{ decade }}.centract2010 = CENSUS_by_tract.centract10
-- LEFT JOIN census_units10adj
-- ON YEARLY_devdb_{{ decade }}.centract2010 = census_units10adj.centract10
-- {% endif %}
GROUP BY
YEARLY_devdb_{{ decade }}.boro,
YEARLY_devdb_{{ decade }}.bct{{ decade }},
YEARLY_devdb_{{ decade }}.centract{{ decade }} |
create table active_user_per_service (
date varchar(8) NOT NULL,
VID int(8),
VI int (8),
VISMS int (8),
VIM int (8),
VMMS int (8),
VIMM int (8),
VIG int (8),
VLTE int (8),
VGG int (8),
TOTAL int (8)
) DEFAULT CHARACTER SET utf8;
create table active_user_per_operator (
date varchar(8) NOT NULL,
BSZX01 int(8),
BWTX01 int(8),
DXT001 int(8),
GOME01 int(8),
HHLX01 int(8),
JDTX01 int(8),
LYSJ01 int(8),
WWZC01 int(8),
SWHL01 int(8),
ASD001 int(8),
SNYS01 int(8),
SZWN01 int(8),
TYTX01 int(8),
YTTX01 int(8),
CCSD01 int(8),
LLKJ01 int(8),
ZQJT01 int(8),
HJSJ01 int(8),
FXZX01 int(8),
ZYSJ01 int(8),
GZLM01 int(8),
YSDZ01 int(8),
PBS001 int(8),
SJHL01 int(8),
ZXST01 int(8)
) DEFAULT CHARACTER SET utf8;
create table active_user_per_prov (
date varchar(8) NOT NULL,
BeiJing_100 int(8),
GuangDong_200 int(8),
ShangHai_210 int(8),
TianJin_220 int(8),
ChongQin_230 int(8),
LiaoNing_240 int(8),
JiangSu_250 int(8),
HuBei_270 int(8),
SiChuan_280 int(8),
ShanXi_290 int(8),
HeBei_311 int(8),
ShanXi_351 int(8),
HeNan_371 int(8),
JiLin_431 int(8),
HeiLongJiang_451 int(8),
NeiMengGu_471 int(8),
ShanDong_531 int(8),
AnHui_551 int(8),
ZheJiang_571 int(8),
FuJian_591 int(8),
HuNan_731 int(8),
GuangXi_771 int(8),
JiangXi_791 int(8),
GuiZhou_851 int(8),
YunNan_871 int(8),
XiZang_891 int(8),
HaiNan_898 int(8),
GanSu_931 int(8),
NingXia_951 int(8),
QingHai_971 int(8),
XinJiang_991 int(8)
) DEFAULT CHARACTER SET utf8;
|
DROP DATABASE IF EXISTS bamazon_DB;
CREATE DATABASE bamazon_DB;
USE bamazon_DB;
CREATE TABLE products (
item_id INT NOT NULL AUTO_INCREMENT,
product_name VARCHAR(200) NULL,
department_name VARCHAR(50) NULL,
price DECIMAL(10, 2),
stock_quantity INT,
PRIMARY KEY (id)
);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Galaxy School Outfit", "Clothing", 25.50, 300);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Masaaki Endoh CD", "Music", 14.00, 35);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Voltron: Legendary Defender Blu-Ray", "Entertainment", 22.50, 108);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Chocolate Chip Muffie", "Food", 1.75, 6);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Macbook", "Electronics", 1200, 8000);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Multicolored Hairties", "Beauty", 0.75, 175);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Pocketknife", "Outdoors", 12.35, 41);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Aimer Poster", "Music", 7.77, 10);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Iced Cookies", "Food", 3.21, 11);
INSERT INTO products (product_name, department_name, price, stock_quantity)
VALUES ("Mr. Hippo Storybook", "Books", 4.00, 0);
|
connect 'jdbc:derby://localhost:1527/matedu;user=root;password=root;create=true;';
create table usuario(
id int PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
email varchar(128) not null,
nombre varchar(128) not null,
password varchar(32) not null
);
create table material(
id int PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
nombre varchar(128) not null,
descripcion varchar(512) not null,
autor varchar(32) not null,
valor varchar(512) not null,
rutaArchivo varchar(512) not null
); |
-- phpMyAdmin SQL Dump
-- version 4.7.9
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 22, 2018 at 10:39 AM
-- Server version: 10.1.31-MariaDB
-- PHP Version: 7.2.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: `vezbamvc`
--
CREATE DATABASE IF NOT EXISTS `vezbamvc` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `vezbamvc`;
-- --------------------------------------------------------
--
-- Table structure for table `posts`
--
CREATE TABLE `posts` (
`id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`body` text NOT NULL,
`link` varchar(255) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`user_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `posts`
--
INSERT INTO `posts` (`id`, `title`, `body`, `link`, `created_at`, `user_id`) VALUES
(1, 'Test post', 'Test post', 'https://www.google.rs/', '2018-05-22 08:37:56', 1);
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`password` varchar(100) NOT NULL,
`create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `create_date`) VALUES
(1, 'Test admin', 'test@gmail.com', 'cc03e747a6afbbcbf8be7668acfebee5', '2018-05-22 08:37:40');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `posts`
--
ALTER TABLE `posts`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `posts`
--
ALTER TABLE `posts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `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 */;
|
Create Function merp_fn_Get_StockReconcile_ZeroBatch(@Product_Code nVarchar(50))
Returns @ZeroBatchInfo Table (Product_Code nVarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS, Batch_Number nVarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS)
As
Begin
Insert into @ZeroBatchInfo
Select Product_Code, IsNull(Batch_number,'')
From Batch_Products
Where Product_code = @Product_Code
Group by Product_Code, IsNull(Batch_number,'')
Having Sum(Quantity) = 0
Order by IsNull(Batch_number,'')
Return
End
|
-- displays the top 3 of cities temperature during July and August ordered by temperature
SELECT city, SUM(value)/COUNT(city) AS avg_temp FROM temperatures
WHERE month IN (7, 8)
GROUP BY city ORDER BY avg_temp DESC LIMIT 3;
|
/* Создание процедуры генерации таблиц всех представлений */
CREATE PROCEDURE /*PREFIX*/R_PRESENTATIONS
(
)
BEGIN
DECLARE PRESENTATION_ID VARCHAR(32);
DECLARE DONE INTEGER DEFAULT 0;
DECLARE C1 CURSOR FOR SELECT P.PRESENTATION_ID
FROM /*PREFIX*/PRESENTATIONS P;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET DONE=1;
OPEN C1;
FETCH C1 INTO PRESENTATION_ID;
WHILE NOT DONE DO
CALL /*PREFIX*/R_PRESENTATION (PRESENTATION_ID);
FETCH C1 INTO PRESENTATION_ID;
END WHILE;
CLOSE C1;
END;
--
|
DROP TABLE plch_orders;
CREATE TABLE plch_orders
(
order_id INTEGER PRIMARY KEY
, order_date DATE
, status VARCHAR2 (100)
)
/
BEGIN
INSERT INTO plch_orders
VALUES (100, DATE '2010-01-15', 'CLOSED');
INSERT INTO plch_orders
VALUES (200, DATE '2010-11-15', 'OPEN');
INSERT INTO plch_orders
VALUES (300, DATE '2011-01-15', 'CLOSED');
INSERT INTO plch_orders
VALUES (400, DATE '2011-11-15', 'OPEN');
COMMIT;
END;
/
CREATE OR REPLACE PROCEDURE plch_show_orders()
IS
CURSOR c_get_id(p_status plch_orders.status%TYPE)
IS
SELECT order_id
FROM plch_orders
WHERE status = p_status
ORDER BY status DESC,order_date DESC;
--ln_orders plch_orders%ROWTYPE;
ln_order_id plch_orders.order_id%TYPE;
BEGIN
OPEN c_get_id('%');
LOOP
FETCH c_get_id INTO ln_order_id;
EXIT WHEN c_get_id%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(ln_order_id);
END LOOP;
CLOSE c_get_id;
END plch_show_orders;
/
SET SERVEROUTPUT ON
BEGIN
plch_show_orders();
plch_show_orders();
END;
/
|
--test insert to an empty limitedCourse--
\echo '------test insert to an empty limitedCourse-------';
SELECT * FROM registrations WHERE course = 'TESLIM';
INSERT INTO registrations VALUES(101,'TESLIM');
INSERT INTO registrations VALUES(102,'TESLIM');
SELECT * FROM registrations WHERE course = 'TESLIM';
--test insert to a full limitedCourse--
\echo '------test insert to a full limitedCourse-------';
INSERT INTO registrations VALUES(103,'TESLIM');
SELECT * FROM registrations WHERE course = 'TESLIM';
--test insert when student already is in queue or registrated to the course--
\echo '------test if student already is in queue or registrated to the course-------';
INSERT INTO registrations VALUES(102,'TESLIM');
SELECT * FROM registrations WHERE course = 'TESLIM';
--test when student already passed the course--
\echo '------test when student already passed the course-------';
INSERT INTO hasread VALUES(104,'TESLIM','3');
SELECT * FROM hasread WHERE ssn = 104;
INSERT INTO registrations VALUES(104,'TESLIM');
SELECT * FROM registrations WHERE course = 'TESLIM';
--test when student doesn´t fulfill required courses--
\echo '------test when student doesn´t fulfill required courses-------';
SELECT * FROM requires WHERE courseone = 'TESRE1';
SELECT * FROM hasread WHERE ssn ='101';
INSERT INTO registrations VALUES(101,'TESRE1');
SELECT * FROM registrations WHERE course = 'TESRE1';
--test when student fulfill requirements--
\echo '------test when student fulfill requirements-------';
INSERT INTO hasread VALUES('101','TESRE2','3');
SELECT * FROM hasread WHERE ssn ='101';
INSERT INTO registrations VALUES(101,'TESRE1');
SELECT * FROM registrations WHERE course = 'TESRE1';
--unregistrate student from course with a queue--
\echo '------unregistrate student from course with a queue-------';
SELECT * FROM registrations WHERE course = 'TESLIM';
DELETE FROM registrations WHERE course = 'TESLIM' AND ssn = 101;
SELECT * FROM registrations WHERE course ='TESLIM';
--unregistrate student from an overcrowded crouse with a queue--
\echo '------unregistrate student from an overcrowded crouse with a queue-------';
INSERT INTO registeredto VALUES(101,'TESLIM');
INSERT INTO registrations VALUES('105','TESLIM');
SELECT * FROM limitedcourses WHERE code = 'TESLIM';
SELECT * FROM registrations WHERE course ='TESLIM';
DELETE FROM registrations WHERE course = 'TESLIM' AND ssn = 101;
SELECT * FROM registrations WHERE course ='TESLIM';
|
-- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 12, 2013 at 10:31 PM
-- Server version: 5.6.12-log
-- PHP Version: 5.4.16
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: `galerija`
--
-- --------------------------------------------------------
--
-- Table structure for table `upload`
--
CREATE TABLE IF NOT EXISTS `upload` (
`id_upload` int(11) NOT NULL AUTO_INCREMENT,
`id_user` int(11) NOT NULL,
`slika1` text NOT NULL,
`slika2` text NOT NULL,
`vreme` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`f_odobreno` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id_upload`),
KEY `f_key_id_user` (`id_user`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
--
-- Dumping data for table `upload`
--
INSERT INTO `upload` (`id_upload`, `id_user`, `slika1`, `slika2`, `vreme`, `f_odobreno`) VALUES
(1, 4, '../files/4/1.jpg', '../files/4/2.jpg', '2013-11-12 20:02:26', 0),
(2, 6, '../files/6/1.jpg', '../files/6/2.jpg', '2013-11-12 21:57:18', 0),
(3, 7, '..files/7/1.jpg', '..files/7/2.jpg', '2013-11-12 22:14:20', 0);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `upload`
--
ALTER TABLE `upload`
ADD CONSTRAINT `f_key` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`) 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 */;
|
create user SmartCoast@'%' identified by '123VORbei!';
grant all privileges on *.* to SmartCoast@'%';
flush privileges;
quit
|
with inv as
(
select w_warehouse_name
, w_warehouse_sk
, i_item_sk
, d_moy
, stdev
, mean,
case mean when 0 then null else stdev/mean end cov
from(
select w_warehouse_name
, w_warehouse_sk
, i_item_sk
, d_moy
, stddev_samp(inv_quantity_on_hand) stdev
, avg(inv_quantity_on_hand) mean
from inventory
, item
, warehouse
, date_dim
where inv_item_sk = i_item_sk
and inv_warehouse_sk = w_warehouse_sk
and inv_date_sk = d_date_sk
and d_year =1999
group by w_warehouse_name
,w_warehouse_sk
,i_item_sk,d_moy
) foo
where case mean when 0 then 0 else stdev/mean end > 1
)
select inv1.w_warehouse_sk
, inv1.i_item_sk
, inv1.d_moy
, inv1.mean
, inv1.cov
, inv2.w_warehouse_sk
, inv2.i_item_sk
, inv2.d_moy
, inv2.mean
, inv2.cov
from inv inv1
, inv inv2
where inv1.i_item_sk = inv2.i_item_sk
and inv1.w_warehouse_sk = inv2.w_warehouse_sk
and inv1.d_moy=3
and inv2.d_moy=3+1
order by inv1.w_warehouse_sk
,inv1.i_item_sk
,inv1.d_moy
,inv1.mean
,inv1.cov
,inv2.d_moy
,inv2.mean
,inv2.cov
;
|
-- MySQL dump 10.13 Distrib 8.0.18, for Win64 (x86_64)
--
-- Host: localhost Database: psi_baza
-- ------------------------------------------------------
-- 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 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 `korisnik`
--
DROP TABLE IF EXISTS `korisnik`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `korisnik` (
`username` varchar(20) NOT NULL,
`password` varchar(20) NOT NULL,
`imeiprezime` varchar(20) DEFAULT NULL,
`email` varchar(40) NOT NULL,
`adresa` varchar(40) DEFAULT NULL,
`telefon` varchar(20) DEFAULT NULL,
`admin` tinyint(1) NOT NULL,
PRIMARY KEY (`username`),
UNIQUE KEY `username_UNIQUE` (`username`),
UNIQUE KEY `email_UNIQUE` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `korisnik`
--
LOCK TABLES `korisnik` WRITE;
/*!40000 ALTER TABLE `korisnik` DISABLE KEYS */;
/*!40000 ALTER TABLE `korisnik` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `lf`
--
DROP TABLE IF EXISTS `lf`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `lf` (
`izgpro` tinyint(1) DEFAULT NULL,
`oglasId` int(11) NOT NULL,
PRIMARY KEY (`oglasId`),
UNIQUE KEY `oglasId_UNIQUE` (`oglasId`),
CONSTRAINT `R_1` FOREIGN KEY (`oglasId`) REFERENCES `oglas` (`oglasId`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `lf`
--
LOCK TABLES `lf` WRITE;
/*!40000 ALTER TABLE `lf` DISABLE KEYS */;
/*!40000 ALTER TABLE `lf` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `oglas`
--
DROP TABLE IF EXISTS `oglas`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `oglas` (
`oglasId` int(11) NOT NULL,
`vrsta` varchar(10) NOT NULL,
`pol` varchar(10) DEFAULT NULL,
`rasa` varchar(20) DEFAULT NULL,
`slika` varchar(40) DEFAULT NULL,
`opis` varchar(200) NOT NULL,
`username` varchar(20) NOT NULL,
PRIMARY KEY (`oglasId`),
UNIQUE KEY `oglasId_UNIQUE` (`oglasId`),
KEY `R_4` (`username`),
CONSTRAINT `R_4` FOREIGN KEY (`username`) REFERENCES `korisnik` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `oglas`
--
LOCK TABLES `oglas` WRITE;
/*!40000 ALTER TABLE `oglas` DISABLE KEYS */;
/*!40000 ALTER TABLE `oglas` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `srecnaprica`
--
DROP TABLE IF EXISTS `srecnaprica`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `srecnaprica` (
`srecnapricaId` int(11) NOT NULL,
`slika` varchar(30) DEFAULT NULL,
`opis` varchar(200) DEFAULT NULL,
PRIMARY KEY (`srecnapricaId`),
UNIQUE KEY `srecnapricaId_UNIQUE` (`srecnapricaId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `srecnaprica`
--
LOCK TABLES `srecnaprica` WRITE;
/*!40000 ALTER TABLE `srecnaprica` DISABLE KEYS */;
/*!40000 ALTER TABLE `srecnaprica` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `udomi`
--
DROP TABLE IF EXISTS `udomi`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `udomi` (
`starost` varchar(20) DEFAULT NULL,
`mesto` varchar(20) DEFAULT NULL,
`oglasId` int(11) NOT NULL,
PRIMARY KEY (`oglasId`),
UNIQUE KEY `oglasId_UNIQUE` (`oglasId`),
CONSTRAINT `R_2` FOREIGN KEY (`oglasId`) REFERENCES `oglas` (`oglasId`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `udomi`
--
LOCK TABLES `udomi` WRITE;
/*!40000 ALTER TABLE `udomi` DISABLE KEYS */;
/*!40000 ALTER TABLE `udomi` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `vest`
--
DROP TABLE IF EXISTS `vest`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `vest` (
`vestId` int(11) NOT NULL,
`naslov` varchar(40) DEFAULT NULL,
`slika` varchar(30) DEFAULT NULL,
`opis` varchar(200) DEFAULT NULL,
PRIMARY KEY (`vestId`),
UNIQUE KEY `vestId_UNIQUE` (`vestId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `vest`
--
LOCK TABLES `vest` WRITE;
/*!40000 ALTER TABLE `vest` DISABLE KEYS */;
/*!40000 ALTER TABLE `vest` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `zalba`
--
DROP TABLE IF EXISTS `zalba`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `zalba` (
`zalbaId` int(11) NOT NULL,
`opis` varchar(20) NOT NULL,
`username` varchar(20) NOT NULL,
PRIMARY KEY (`zalbaId`),
UNIQUE KEY `zalbaId_UNIQUE` (`zalbaId`),
UNIQUE KEY `username_UNIQUE` (`username`),
CONSTRAINT `R_3` FOREIGN KEY (`username`) REFERENCES `korisnik` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `zalba`
--
LOCK TABLES `zalba` WRITE;
/*!40000 ALTER TABLE `zalba` DISABLE KEYS */;
/*!40000 ALTER TABLE `zalba` 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 2020-04-14 17:18:12
|
-- phpMyAdmin SQL Dump
-- version 4.8.0.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 15, 2018 at 09:45 AM
-- Server version: 10.1.32-MariaDB
-- PHP Version: 5.6.36
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: `durable_management_system`
--
-- --------------------------------------------------------
--
-- Table structure for table `borrows`
--
CREATE TABLE `borrows` (
`borrow_id` int(11) NOT NULL,
`durable_id` int(11) NOT NULL,
`borrow_date` datetime DEFAULT NULL,
`return_date` datetime DEFAULT NULL,
`borrow_status_id` int(11) NOT NULL,
`users_user_id` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `borrow_status`
--
CREATE TABLE `borrow_status` (
`borrow_status_id` int(11) NOT NULL,
`borrow_status_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `borrow_status`
--
INSERT INTO `borrow_status` (`borrow_status_id`, `borrow_status_name`) VALUES
(1, 'ยืม'),
(2, 'คืน');
-- --------------------------------------------------------
--
-- Table structure for table `buildings`
--
CREATE TABLE `buildings` (
`building_id` int(11) NOT NULL,
`building_name` varchar(255) NOT NULL,
`campus_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `buildings`
--
INSERT INTO `buildings` (`building_id`, `building_name`, `campus_id`) VALUES
(1, 'อาคาร 17', 1);
-- --------------------------------------------------------
--
-- Table structure for table `campus`
--
CREATE TABLE `campus` (
`campus_id` int(11) NOT NULL,
`campus_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `campus`
--
INSERT INTO `campus` (`campus_id`, `campus_name`) VALUES
(1, 'ศูนย์นนทบุรี');
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE `category` (
`cat_id` int(11) NOT NULL,
`cat_name` varchar(255) NOT NULL,
`durable_age` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `category`
--
INSERT INTO `category` (`cat_id`, `cat_name`, `durable_age`) VALUES
(1, 'ครุภัณฑ์คอมพิวเตอร์', 3),
(2, 'ครุภัณฑ์สํานักงาน', 3),
(3, 'ครุภัณฑ์ก่อสร้าง', 3),
(4, 'ครุภัณฑ์ไฟฟ้าและวิทยุ', 3),
(5, 'ครุภัณฑ์วิทยาศาสตร์การแพทย์', 3),
(6, 'ครุภัณฑ์งานบ้านงานครัว', 3),
(7, 'ครุภัณฑ์โรงงาน', 3),
(8, 'ครุภัณฑ์สํารวจ', 3),
(9, 'ครุภัณฑ์อาวุธ', 3),
(10, 'ครุภัณฑ์ดนตรีและนาฏศิลป์', 3),
(11, 'ครุภัณฑ์ยานพาหนะและขนส่ง', 3);
-- --------------------------------------------------------
--
-- Table structure for table `departments`
--
CREATE TABLE `departments` (
`department_id` int(11) NOT NULL,
`department_name` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `departments`
--
INSERT INTO `departments` (`department_id`, `department_name`) VALUES
(1, 'วิทยาศาสตร์และเทคโนโลยี');
-- --------------------------------------------------------
--
-- Table structure for table `durable_article`
--
CREATE TABLE `durable_article` (
`durable_id` int(11) NOT NULL,
`durable_code` varchar(255) NOT NULL,
`durable_name` varchar(255) DEFAULT NULL,
`use_date` date DEFAULT NULL,
`add_date` datetime DEFAULT NULL,
`cat_id` int(11) NOT NULL,
`picture_path` varchar(255) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`price` double DEFAULT NULL,
`durable_status_id` int(11) NOT NULL,
`room_id` int(11) NOT NULL,
`description` longtext,
`durable_age` int(11) DEFAULT NULL,
`scrap_value` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `durable_article`
--
INSERT INTO `durable_article` (`durable_id`, `durable_code`, `durable_name`, `use_date`, `add_date`, `cat_id`, `picture_path`, `user_id`, `price`, `durable_status_id`, `room_id`, `description`, `durable_age`, `scrap_value`) VALUES
(1, '1', 'test1', '2018-09-13', '2018-09-13 00:00:00', 1, 'noimg.jpg', 1, 100000, 1, 17071, 'test1', 3, 1);
-- --------------------------------------------------------
--
-- Table structure for table `durable_status`
--
CREATE TABLE `durable_status` (
`durable_status_id` int(11) NOT NULL,
`durable_status_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `durable_status`
--
INSERT INTO `durable_status` (`durable_status_id`, `durable_status_name`) VALUES
(1, 'ปกติ'),
(2, 'อยู่ระหว่างดำเนินการจำหน่าย'),
(3, 'จำหน่ายเรียบร้อยแล้ว');
-- --------------------------------------------------------
--
-- Table structure for table `problem_report`
--
CREATE TABLE `problem_report` (
`problem_id` int(11) NOT NULL,
`problem_detail` longtext,
`durable_id` int(11) NOT NULL,
`problem_status_id` int(11) NOT NULL,
`report_datetime` datetime DEFAULT NULL,
`reporter_id` varchar(45) DEFAULT NULL,
`reporter_name` varchar(45) DEFAULT NULL,
`reporter_surname` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `problem_status`
--
CREATE TABLE `problem_status` (
`problem_status_id` int(11) NOT NULL,
`problem_status_name` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `problem_status`
--
INSERT INTO `problem_status` (`problem_status_id`, `problem_status_name`) VALUES
(1, 'ใหม่'),
(2, 'ดำเนินการตรวจสอบ'),
(3, 'ดำเนินการแก้ไขปัญหา'),
(4, 'แก้ไขปัญหาเสร็จสิ้น'),
(5, 'ไม่สามารถแก้ไขปัญหาได้');
-- --------------------------------------------------------
--
-- Table structure for table `rooms`
--
CREATE TABLE `rooms` (
`room_id` int(11) NOT NULL,
`room_name` varchar(255) DEFAULT NULL,
`building_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `rooms`
--
INSERT INTO `rooms` (`room_id`, `room_name`, `building_id`) VALUES
(17071, '17071', 1);
-- --------------------------------------------------------
--
-- Table structure for table `sub_departments`
--
CREATE TABLE `sub_departments` (
`sub_department_id` int(11) NOT NULL,
`sub_department_name` varchar(45) DEFAULT NULL,
`department_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `sub_departments`
--
INSERT INTO `sub_departments` (`sub_department_id`, `sub_department_name`, `department_id`) VALUES
(1, 'วิทยาการคอมพิวเตอร์', 1);
-- --------------------------------------------------------
--
-- Table structure for table `sysconfig`
--
CREATE TABLE `sysconfig` (
`syscode` char(3) NOT NULL COMMENT 'รหัส',
`sysvalue` varchar(255) DEFAULT NULL COMMENT 'ค่า',
`sysdesc` varchar(255) DEFAULT NULL COMMENT 'ราย'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `sysconfig`
--
INSERT INTO `sysconfig` (`syscode`, `sysvalue`, `sysdesc`) VALUES
('FBP', './books/', 'Path book'),
('FHP', 'C:/xampp/htdocs/ebook/books/', 'Host path'),
('FIB', '/files/shot.png', 'Img book'),
('FPI', './pdfimage/', 'PDF image path'),
('FPP', './pdf/', 'PDF path'),
('HOS', 'rmutsb.ac.th', 'Domain E-mail สำหรับใช้งาน'),
('HOT', NULL, 'Domain E-mail สำหรับใช้งานของอาจารย์'),
('LIT', '12', 'Limit per page'),
('MAL', 'phongkorn.p@rmutsb.ac.th', 'E-mail for send mail'),
('PAS', 'gugu6645', 'Password for send mail'),
('PRT', '465', 'mail PORT '),
('SER', 'ssl://smtp.gmail.com', 'Mail Server'),
('SYS', 'Durable Article Management System', 'ชื่อระบบ'),
('URL', 'http://127.0.0.1/ebook/', 'URL ebook');
-- --------------------------------------------------------
--
-- Table structure for table `type_user`
--
CREATE TABLE `type_user` (
`type_user_id` char(1) NOT NULL,
`type_user_name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `type_user`
--
INSERT INTO `type_user` (`type_user_id`, `type_user_name`) VALUES
('A', 'Admin'),
('U', 'User');
-- --------------------------------------------------------
--
-- Table structure for table `usage_log`
--
CREATE TABLE `usage_log` (
`usage_id` int(11) NOT NULL,
`durable_id` int(11) NOT NULL,
`usage_datetime` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`user_id` int(11) NOT NULL,
`user_name` varchar(255) DEFAULT NULL,
`user_surname` varchar(255) DEFAULT NULL,
`user_email` varchar(255) NOT NULL,
`user_password` varchar(40) DEFAULT NULL,
`user_image_path` varchar(255) DEFAULT NULL,
`user_status_id` char(1) NOT NULL,
`type_user_id` char(1) NOT NULL,
`register_date` datetime DEFAULT NULL,
`sub_department_id` int(11) NOT NULL,
`token` char(32) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`user_id`, `user_name`, `user_surname`, `user_email`, `user_password`, `user_image_path`, `user_status_id`, `type_user_id`, `register_date`, `sub_department_id`, `token`) VALUES
(1, 'กฤติกาล', 'วีระกะลัส', 'krit@mail.com', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 'noimg.jpg', 'Y', 'A', '2018-09-12 00:00:00', 1, ''),
(2, 'Krittikarn', 'Verakalas', 'krittikarn@mail.com', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 'noimg.jpg', 'Y', 'U', '2018-09-13 00:00:00', 1, '');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `borrows`
--
ALTER TABLE `borrows`
ADD PRIMARY KEY (`borrow_id`),
ADD KEY `fk_borrows_durable_article1_idx` (`durable_id`),
ADD KEY `fk_borrows_borrow_status1_idx` (`borrow_status_id`),
ADD KEY `fk_borrows_users1_idx` (`users_user_id`);
--
-- Indexes for table `borrow_status`
--
ALTER TABLE `borrow_status`
ADD PRIMARY KEY (`borrow_status_id`);
--
-- Indexes for table `buildings`
--
ALTER TABLE `buildings`
ADD PRIMARY KEY (`building_id`),
ADD KEY `fk_buildings_campus1_idx` (`campus_id`);
--
-- Indexes for table `campus`
--
ALTER TABLE `campus`
ADD PRIMARY KEY (`campus_id`);
--
-- Indexes for table `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`cat_id`);
--
-- Indexes for table `departments`
--
ALTER TABLE `departments`
ADD PRIMARY KEY (`department_id`);
--
-- Indexes for table `durable_article`
--
ALTER TABLE `durable_article`
ADD PRIMARY KEY (`durable_id`),
ADD UNIQUE KEY `durable_code_UNIQUE` (`durable_code`),
ADD KEY `fk_durable_article_durable_status_idx` (`durable_status_id`),
ADD KEY `fk_durable_article_users1_idx` (`user_id`),
ADD KEY `fk_durable_article_category1_idx` (`cat_id`),
ADD KEY `fk_durable_article_rooms1_idx` (`room_id`);
--
-- Indexes for table `durable_status`
--
ALTER TABLE `durable_status`
ADD PRIMARY KEY (`durable_status_id`);
--
-- Indexes for table `problem_report`
--
ALTER TABLE `problem_report`
ADD PRIMARY KEY (`problem_id`),
ADD KEY `fk_problem_report_durable_article1_idx` (`durable_id`),
ADD KEY `fk_problem_report_problem_status1_idx` (`problem_status_id`);
--
-- Indexes for table `problem_status`
--
ALTER TABLE `problem_status`
ADD PRIMARY KEY (`problem_status_id`);
--
-- Indexes for table `rooms`
--
ALTER TABLE `rooms`
ADD PRIMARY KEY (`room_id`),
ADD KEY `fk_rooms_buildings1_idx` (`building_id`);
--
-- Indexes for table `sub_departments`
--
ALTER TABLE `sub_departments`
ADD PRIMARY KEY (`sub_department_id`),
ADD KEY `fk_sub_departments_departments1_idx` (`department_id`);
--
-- Indexes for table `sysconfig`
--
ALTER TABLE `sysconfig`
ADD PRIMARY KEY (`syscode`);
--
-- Indexes for table `type_user`
--
ALTER TABLE `type_user`
ADD PRIMARY KEY (`type_user_id`);
--
-- Indexes for table `usage_log`
--
ALTER TABLE `usage_log`
ADD PRIMARY KEY (`usage_id`),
ADD KEY `fk_usage_log_durable_article1_idx` (`durable_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`user_id`),
ADD UNIQUE KEY `user_email_UNIQUE` (`user_email`),
ADD KEY `fk_users_type_user1_idx` (`type_user_id`),
ADD KEY `fk_users_sub_departments1_idx` (`sub_department_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `borrows`
--
ALTER TABLE `borrows`
MODIFY `borrow_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `borrow_status`
--
ALTER TABLE `borrow_status`
MODIFY `borrow_status_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `buildings`
--
ALTER TABLE `buildings`
MODIFY `building_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `campus`
--
ALTER TABLE `campus`
MODIFY `campus_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `category`
--
ALTER TABLE `category`
MODIFY `cat_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `departments`
--
ALTER TABLE `departments`
MODIFY `department_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `durable_article`
--
ALTER TABLE `durable_article`
MODIFY `durable_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `durable_status`
--
ALTER TABLE `durable_status`
MODIFY `durable_status_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `problem_report`
--
ALTER TABLE `problem_report`
MODIFY `problem_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `problem_status`
--
ALTER TABLE `problem_status`
MODIFY `problem_status_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `sub_departments`
--
ALTER TABLE `sub_departments`
MODIFY `sub_department_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `usage_log`
--
ALTER TABLE `usage_log`
MODIFY `usage_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `borrows`
--
ALTER TABLE `borrows`
ADD CONSTRAINT `fk_borrows_borrow_status1` FOREIGN KEY (`borrow_status_id`) REFERENCES `borrow_status` (`borrow_status_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_borrows_durable_article1` FOREIGN KEY (`durable_id`) REFERENCES `durable_article` (`durable_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_borrows_users1` FOREIGN KEY (`users_user_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `buildings`
--
ALTER TABLE `buildings`
ADD CONSTRAINT `fk_buildings_campus1` FOREIGN KEY (`campus_id`) REFERENCES `campus` (`campus_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `durable_article`
--
ALTER TABLE `durable_article`
ADD CONSTRAINT `fk_durable_article_category1` FOREIGN KEY (`cat_id`) REFERENCES `category` (`cat_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_durable_article_durable_status` FOREIGN KEY (`durable_status_id`) REFERENCES `durable_status` (`durable_status_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_durable_article_rooms1` FOREIGN KEY (`room_id`) REFERENCES `rooms` (`room_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_durable_article_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `problem_report`
--
ALTER TABLE `problem_report`
ADD CONSTRAINT `fk_problem_report_durable_article1` FOREIGN KEY (`durable_id`) REFERENCES `durable_article` (`durable_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_problem_report_problem_status1` FOREIGN KEY (`problem_status_id`) REFERENCES `problem_status` (`problem_status_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `rooms`
--
ALTER TABLE `rooms`
ADD CONSTRAINT `fk_rooms_buildings1` FOREIGN KEY (`building_id`) REFERENCES `buildings` (`building_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `sub_departments`
--
ALTER TABLE `sub_departments`
ADD CONSTRAINT `fk_sub_departments_departments1` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `usage_log`
--
ALTER TABLE `usage_log`
ADD CONSTRAINT `fk_usage_log_durable_article1` FOREIGN KEY (`durable_id`) REFERENCES `durable_article` (`durable_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `fk_users_sub_departments1` FOREIGN KEY (`sub_department_id`) REFERENCES `sub_departments` (`sub_department_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `fk_users_type_user1` FOREIGN KEY (`type_user_id`) REFERENCES `type_user` (`type_user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
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 */;
|
-- SCHEMA MIGRATION: BEGIN
-- CREATE TABLES: BEGIN
CREATE TABLE images ( id TEXT NOT NULL PRIMARY KEY, value BLOB NOT NULL );
CREATE TABLE classes ( id TEXT NOT NULL PRIMARY KEY, name TEXT NOT NULL, parent_id TEXT, FOREIGN KEY (parent_id) REFERENCES classes(id) );
CREATE TABLE categories ( id TEXT NOT NULL PRIMARY KEY, name TEXT NOT NULL, idx INTEGER, images_id TEXT, is_default BOOL NOT NULL DEFAULT N, last_modified TEXT NOT NULL, default_class_id TEXT NOT NULL, FOREIGN KEY (images_id) REFERENCES images(id) FOREIGN KEY (default_class_id) REFERENCES classes(id) );
CREATE INDEX idx_categories_name ON categories (name);
CREATE INDEX idx_categories_idx ON categories (idx);
CREATE INDEX idx_categories_is_default ON categories (is_default);
CREATE INDEX idx_categories_last_modified ON categories (last_modified);
CREATE TABLE items ( id TEXT NOT NULL PRIMARY KEY, category_id TEXT, class_id TEXT NOT NULL, images_id TEXT, name TEXT NOT NULL, is_default BOOL NOT NULL DEFAULT N, touched_at TEXT, last_modified TEXT NOT NULL, FOREIGN KEY (category_id) REFERENCES categories(id), FOREIGN KEY (class_id) REFERENCES classes(id), FOREIGN KEY (images_id) REFERENCES images(id) );
CREATE INDEX idx_items_name ON items (name);
CREATE INDEX idx_items_is_default ON items (is_default);
CREATE INDEX idx_categories_touched_at ON items (touched_at);
CREATE INDEX idx_items_last_modified ON items (last_modified);
CREATE TABLE fields ( id TEXT NOT NULL PRIMARY KEY, items_id TEXT NOT NULL, idx INTEGER, field_types_id TEXT NOT NULL, value TEXT, title TEXT NOT NULL, is_mandatory BOOL NOT NULL DEFAULT N, is_searchable BOOL NOT NULL DEFAULT N, is_subtitle BOOL NOT NULL DEFAULT N, FOREIGN KEY (items_id) REFERENCES items(id), FOREIGN KEY (field_types_id) REFERENCES field_types(id) );
CREATE INDEX idx_fields_idx ON fields (idx);
CREATE INDEX idx_fields_is_searchable ON fields (is_searchable);
CREATE TABLE field_types ( id TEXT NOT NULL PRIMARY KEY, mode TEXT NOT NULL, name TEXT NOT NULL, is_default BOOL NOT NULL DEFAULT Y, last_modified TEXT NOT NULL );
CREATE INDEX idx_field_types_is_default ON field_types (is_default);
CREATE TABLE classes_template_fields ( id TEXT NOT NULL PRIMARY KEY, class_id TEXT NOT NULL, idx INTEGER, field_types_id TEXT NOT NULL, value TEXT, title TEXT NOT NULL, is_mandatory BOOL NOT NULL DEFAULT N, is_searchable BOOL NOT NULL DEFAULT N, is_subtitle BOOL NOT NULL DEFAULT N, FOREIGN KEY (class_id) REFERENCES classes(id), FOREIGN KEY (field_types_id) REFERENCES field_types(id) );
CREATE INDEX idx_classes_template_fields_idx ON classes_template_fields (idx);
CREATE INDEX idx_classes_template_fields_is_searchable ON classes_template_fields (is_searchable);
CREATE TABLE settings ( id TEXT NOT NULL PRIMARY KEY, scope TEXT NOT NULL, name TEXT NOT NULL, value TEXT );
CREATE INDEX idx_settings_scope ON settings (scope);
CREATE INDEX idx_settings_name ON settings (name);
-- CREATE TABLES: END
-- ALTER TABLES: BEGIN
ALTER TABLE attachment RENAME TO attachments;
ALTER TABLE card_type RENAME TO card_types;
ALTER TABLE currency RENAME TO currencies;
ALTER TABLE account_type RENAME TO account_types;
UPDATE account_types SET name = 'CURRENT' WHERE name = 'OTHER';
-- ALTER TABLES: END
-- SCHEMA MIGRATION: END
-- APP-PREDEFINED DATA MIGRATION: BEGIN
-------------------------------------------- 1. SETTINGS -----------------------------------------------
--DB Schema version of WIDA 2.0 is 3.0
--INSERT INTO settings (id, scope, name, value) VALUES (hex(randomblob(4)), '[app]', 'db_schema_version', '3.0');
--DB Schema version of WIDA 2.1 is 3.1
--Initial DB of WIDA 2.0 & 2.1 is the Same except that DB of WIDA 2.1 DOES NOT have 'WISeAuthentic' default category
INSERT INTO settings (id, scope, name, value) VALUES (hex(randomblob(4)), '[app]', 'db_schema_version', '3.1');
-------------------------------------------- 2. ITEM CLASSES & CATEGORIES -----------------------------------------------
-- CLASSES --
-- insert GENERIC_ITEM item class
INSERT INTO classes (id, name) VALUES ('CLS_0', 'GENERIC_ITEM');
-- insert a default item class for each of the default categories
INSERT INTO classes (id, name, parent_id) select id, name, 'CLS_0' from template_category where name <> 'WISeAuthentic' and name is not null;
-- CATEGORIES --
-- Migrate default category icons --
INSERT INTO images (id, value) select id, image from template_category where name <> 'WISeAuthentic' and name is not null and image is not null;
-- Migrate default categories
INSERT INTO categories (id, default_class_id, name, idx, last_modified, is_default, images_id) select t1.id, t1.id, t1.name, t1.idx, datetime('now'), 'Y', t3.id from template_category t1 left join images t3 on t1.id = t3.id where t1.name <> 'WISeAuthentic' and t1.name is not null;
-------------------------------------------- 3. ALL TEMPLATE ITEMS -----------------------------------------------
-- Migrate default item icons --
INSERT INTO images (id, value) select id, image from template_item where category_id <> (select id from template_category where name = 'WISeAuthentic') and name is not null and image is not null;
-- Migrate default items --
INSERT INTO items (id, category_id, class_id, name, is_default, last_modified, images_id) select t1.id, t1.category_id, t1.category_id, t1.name, 'Y', datetime('now'), t3.id from template_item t1 left join images t3 on t1.id = t3.id where t1.category_id <> (select id from template_category where name = 'WISeAuthentic') and t1.category_id is not null and t1.name is not null and (select scope from template_category where id = t1.category_id) = '[ITEM]';
-------------------------------------------- 4. FIELDS of ALL TEMPLATE ITEMS -----------------------------------------------
INSERT INTO fields (id, items_id, idx, field_types_id, value, is_mandatory, is_searchable, is_subtitle, title) select hex(randomblob(8)), item_id, idx, type_id, value, ifnull(isMandatory,'N'), ifnull(isSearchable,'N'), ifnull(isSubtitle,'N'), title from template_field where item_id is not null and type_id is not null and title is not null and item_id in (select id from items);
-------------------------------------------- 5. TEMPLATE FIELDS of ALL TEMPLATE CATEGORIES -----------------------------------------------
INSERT INTO classes_template_fields (id, class_id, idx, field_types_id, is_mandatory, is_searchable, is_subtitle, title) SELECT hex(randomblob(8)), category_id, idx, type_id, ifnull(isMandatory,'N'), ifnull(isSearchable,'N'), ifnull(isSubtitle,'N'), title FROM template_master_field WHERE category_id IN (select id from template_category where name <> 'WISeAuthentic') and category_id is not null and type_id is not null and title is not null;
-------------------------------------------- 6. MIGRATE ALL OLD FIELD TYPES -----------------------------------------------
INSERT INTO field_types (id, mode, name, last_modified) select id, mode, name , created_at from field_type;
-- APP-PREDEFINED DATA MIGRATION: END
-- USER-CUSTOM DATA MIGRATION: BEGIN
-------------------------------------------- 1. ALL CUSTOM CATEGORIES (HAS NO icon/image) -----------------------------------------------
-- CATEGORY icons --
INSERT INTO images (id, value) select id, image from category where image is not null;
-- Migrate user custom categories which all use GENERIC_ITEM as its default item class
INSERT INTO categories (id, default_class_id, name, idx, last_modified, is_default, images_id) select t1.id, 'CLS_0', t1.name, t1.idx, datetime('now'), 'N', t3.id from category t1 left join images t3 on t1.id = t3.id;
-------------------------------------------- 2. ALL CUSTOM ITEMS -----------------------------------------------
-- ITEM icons --
INSERT INTO images (id, value) select id, image from item where image is not null;
-- ITEM --
-- UNDER a Template category --
INSERT INTO items (id, category_id, class_id, name, is_default, last_modified, images_id) select t1.id, t1.category_id, t1.category_id, t1.name, 'N', datetime('now'), t3.id from item as t1 left join images as t3 on t1.id = t3.id, template_category as t2 where t1.category_id = t2.id and t1.category_id <> (select id from template_category where name = 'WISeAuthentic') and t1.category_id is not null and t1.name is not null;
-- UNDER a Custom category --
INSERT INTO items (id, category_id, class_id, name, is_default, last_modified, images_id) select t1.id, t1.category_id, 'CLS_0', t1.name, 'N', datetime('now'), t3.id from item as t1 left join images as t3 on t1.id = t3.id, category as t2 where t1.category_id = t2.id and t1.category_id is not null and t1.name is not null;
-------------------------------------------- 3. FIELDS of ALL CUSTOM ITEMS -----------------------------------------------
-- fields of ITEM of TEMPLATE CATEGORY --
INSERT INTO fields (id, items_id, idx, field_types_id, value, is_mandatory, is_searchable, is_subtitle, title) select hex(randomblob(8)), item_id, idx, type_id, ( case when ( attachment is not null ) then attachment else value end ), ifnull(isMandatory,'N'), ifnull(isSearchable,'N'), ifnull(isSubtitle,'N'), title from field where item_id is not null and type_id is not null and title is not null;
-------------------------------------------- 4. UPDATE name OF ITEM CLASSES -----------------------------------------------
-- Update name of default item classes, setting its value to the associated category name + ' ITEM'
UPDATE classes SET name = (name || ' ITEM') WHERE parent_id is not null;
-------------------------------------------- 5. UPDATE FIELD TYPES -----------------------------------------------
-- REPLACE dropdown_accounttype BY account-type --
UPDATE field_types SET mode = 'account-type', name = 'Account Type' WHERE mode = 'dropdown_accounttype';
-- REPLACE dropdown_cardtype BY card-type --
UPDATE field_types SET mode = 'card-type', name = 'Credit Card' WHERE mode = 'dropdown_cardtype';
-- REPLACE dropdown_currency BY currency --
UPDATE field_types SET mode = 'currency', name = 'Currency' WHERE mode = 'dropdown_currency';
-- textfield --
UPDATE field_types SET name = 'Text' WHERE mode = 'textfield';
-- textarea --
UPDATE field_types SET name = 'Note' WHERE mode = 'textarea';
-- password --
UPDATE field_types SET name = 'Password' WHERE mode = 'password';
-- email --
UPDATE field_types SET mode = 'email', name = 'Email' WHERE mode = 'textfield_email';
-- REPLACE TYPES 'datefield_month' & 'datefield_year' WITH 'datefield' in ALL FIELDS --
UPDATE fields SET field_types_id = (select id from field_types where mode = 'datefield') WHERE field_types_id IN (select id from field_types where mode = 'datefield_month' OR mode = 'datefield_year');
-- date/Date --
UPDATE field_types SET mode = 'date', name = 'Date' WHERE mode = 'datefield';
-- number --
UPDATE field_types SET mode = 'number', name = 'Account Number' WHERE mode = 'textfield_number';
-- pin --
UPDATE field_types SET mode = 'pin', name = 'Pin' WHERE mode = 'password_number';
-- phone --
UPDATE field_types SET mode = 'phone', name = 'Phone' WHERE mode = 'textfield_phonenumber';
-- url --
UPDATE field_types SET mode = 'url', name = 'Website' WHERE mode = 'textfield_url';
-- attachment --
UPDATE field_types SET mode = 'attachment', name = 'Photo' WHERE mode = 'photo';
-- DELETE Useless field types --
DELETE FROM field_types WHERE mode IN ( 'button', 'action:addfield', 'action:tfhideplain', 'icon', 'datefield_month', 'datefield_year');
-- USER-CUSTOM DATA MIGRATION: END
-- POST-MIGRATION Fixed ID for Default Elements: BEGIN
-- classes
UPDATE categories SET default_class_id = ('CLS_' || (select rowid from template_category where id = categories.default_class_id)) WHERE default_class_id <> 'CLS_0';
UPDATE items SET class_id = ('CLS_' || (select rowid from template_category where id = items.class_id)) WHERE class_id <> 'CLS_0';
UPDATE classes_template_fields SET class_id = ('CLS_' || (select rowid from template_category where id = classes_template_fields.class_id)) WHERE class_id <> 'CLS_0';
UPDATE classes SET id = ('CLS_' || (select rowid from template_category where id = classes.id)) WHERE id <> 'CLS_0';
-- categories
UPDATE items SET category_id = ('CAT_' || (select rowid from template_category where id = items.category_id)) WHERE category_id IN (select id from categories where is_default = 'Y');
UPDATE categories SET id = ('CAT_' || (select rowid from template_category where id = categories.id)) WHERE is_default = 'Y';
UPDATE images SET id = ((select id from categories where is_default = 'Y' and images_id = images.id) || '_IMG') WHERE id IN (select images_id from categories where images_id is not null and is_default = 'Y');
UPDATE categories SET images_id = (id || '_IMG') WHERE images_id IS NOT NULL AND is_default = 'Y';
-- items
UPDATE fields SET items_id = ('ITM_' || (select rowid from template_item where id = fields.items_id)) WHERE items_id IN (select id from items where is_default = 'Y');
UPDATE items SET id = ('ITM_' || (select rowid from template_item where id = items.id)) WHERE is_default = 'Y';
UPDATE images SET id = ((select id from items where is_default = 'Y' and images_id = images.id) || '_IMG') WHERE id IN (select images_id from items where images_id is not null and is_default = 'Y');
UPDATE items SET images_id = (id || '_IMG') WHERE images_id IS NOT NULL AND is_default = 'Y';
-- fields
-- idx
UPDATE fields SET idx = 5 WHERE title = 'Account Number' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 3 WHERE title = 'Bank Branch' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 10 WHERE title = 'Bank Contact Number' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 9 WHERE title = 'Bank Contact Person' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 4 WHERE title = 'Bank URL' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 4 WHERE title = 'CSC/CVV' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 1 WHERE title = 'Card Holder' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 3 WHERE title = 'Card Number' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 2 WHERE title = 'Card Type' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 6 WHERE title = 'Code/Password' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 3 WHERE title = 'Contact Number' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 11 WHERE title = 'Currency' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 5 WHERE title = 'Date of Purchase' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 3 WHERE title = 'Description' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 7 WHERE title = 'Emergency Contact' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 6 WHERE title = 'Expiration Date' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 1 WHERE title = 'Holder Name' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 7 WHERE title = 'IBAN' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 1 WHERE title = 'Member Number' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 2 WHERE title = 'Member PIN/Password' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 9 WHERE title = 'Member Since' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 1 WHERE title = 'Number' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 5 WHERE title = 'PIN' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 2 WHERE title = 'PIN/Password' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 3 WHERE title = 'Password' AND items_id IN (select id from items where category_id IN ('CAT_1','CAT_2','CAT_3'));
UPDATE fields SET idx = 2 WHERE title = 'Password' AND items_id IN (select id from items where category_id = 'CAT_10');
UPDATE fields SET idx = 10 WHERE title = 'Photo' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 8 WHERE title = 'SWIFT' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 2 WHERE title = 'Serial Number' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 2 WHERE title = 'Type of Account' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 4 WHERE title = 'URL' AND items_id IN (select id from items where category_id = 'CAT_6');
--UPDATE fields SET idx = 3 WHERE title = 'URL' AND items_id IN (select id from items where category_id = 'CAT_7');
-- Fix 'URL/Link' field of 'Frequent Flyer' items
UPDATE fields SET idx = 3, title = 'URL' WHERE title = 'URL/Link' AND items_id IN (select id from items where category_id = 'CAT_7');
UPDATE fields SET idx = 1 WHERE title = 'URL/Link' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 2 WHERE title = 'Username' AND items_id IN (select id from items where category_id = 'CAT_1');
UPDATE fields SET idx = 1 WHERE title = 'Username' AND items_id IN (select id from items where category_id = 'CAT_10');
UPDATE fields SET idx = 2 WHERE title = 'Username/Email' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 8 WHERE title = 'Valid From' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
UPDATE fields SET idx = 4 WHERE title = 'Warranty Period' AND items_id IN (select id from items where category_id GLOB 'CAT_*');
-- id
UPDATE fields SET id = (items_id || '_FIELD_' || idx) WHERE items_id GLOB 'ITM_*';
-- classes_template_fields
-- idx
UPDATE classes_template_fields SET idx = 5 WHERE title = 'Account Number';
UPDATE classes_template_fields SET idx = 3 WHERE title = 'Bank Branch';
UPDATE classes_template_fields SET idx = 10 WHERE title = 'Bank Contact Number';
UPDATE classes_template_fields SET idx = 9 WHERE title = 'Bank Contact Person';
UPDATE classes_template_fields SET idx = 4 WHERE title = 'Bank URL';
UPDATE classes_template_fields SET idx = 4 WHERE title = 'CSC/CVV';
UPDATE classes_template_fields SET idx = 1 WHERE title = 'Card Holder';
UPDATE classes_template_fields SET idx = 3 WHERE title = 'Card Number';
UPDATE classes_template_fields SET idx = 2 WHERE title = 'Card Type';
UPDATE classes_template_fields SET idx = 6 WHERE title = 'Code/Password';
UPDATE classes_template_fields SET idx = 3 WHERE title = 'Contact Number';
UPDATE classes_template_fields SET idx = 11 WHERE title = 'Currency';
UPDATE classes_template_fields SET idx = 5 WHERE title = 'Date of Purchase';
UPDATE classes_template_fields SET idx = 3 WHERE title = 'Description';
UPDATE classes_template_fields SET idx = 7 WHERE title = 'Emergency Contact';
UPDATE classes_template_fields SET idx = 6 WHERE title = 'Expiration Date';
UPDATE classes_template_fields SET idx = 1 WHERE title = 'Holder Name';
UPDATE classes_template_fields SET idx = 7 WHERE title = 'IBAN';
UPDATE classes_template_fields SET idx = 1 WHERE title = 'Member Number';
UPDATE classes_template_fields SET idx = 2 WHERE title = 'Member PIN/Password';
UPDATE classes_template_fields SET idx = 9 WHERE title = 'Member Since';
UPDATE classes_template_fields SET idx = 1 WHERE title = 'Number';
UPDATE classes_template_fields SET idx = 5 WHERE title = 'PIN';
UPDATE classes_template_fields SET idx = 2 WHERE title = 'PIN/Password';
UPDATE classes_template_fields SET idx = 3 WHERE title = 'Password' AND class_id IN ('CLS_1','CLS_2','CLS_3');
UPDATE classes_template_fields SET idx = 2 WHERE title = 'Password' AND class_id = 'CLS_10';
UPDATE classes_template_fields SET idx = 10 WHERE title = 'Photo';
UPDATE classes_template_fields SET idx = 8 WHERE title = 'SWIFT';
UPDATE classes_template_fields SET idx = 2 WHERE title = 'Serial Number';
UPDATE classes_template_fields SET idx = 2 WHERE title = 'Type of Account';
UPDATE classes_template_fields SET idx = 4 WHERE title = 'URL' AND class_id = 'CLS_6';
--UPDATE classes_template_fields SET idx = 3 WHERE title = 'URL' AND class_id = 'CLS_7';
-- Fix 'URL/Link' field of 'Frequent Flyer' category/class
UPDATE classes_template_fields SET idx = 3, title = 'URL' WHERE title = 'URL/Link' AND class_id = 'CLS_7';
UPDATE classes_template_fields SET idx = 1 WHERE title = 'URL/Link';
UPDATE classes_template_fields SET idx = 2 WHERE title = 'Username' AND class_id = 'CLS_1';
UPDATE classes_template_fields SET idx = 1 WHERE title = 'Username' AND class_id = 'CLS_10';
UPDATE classes_template_fields SET idx = 2 WHERE title = 'Username/Email';
UPDATE classes_template_fields SET idx = 8 WHERE title = 'Valid From';
UPDATE classes_template_fields SET idx = 4 WHERE title = 'Warranty Period';
-- id
UPDATE classes_template_fields SET id = (class_id || '_FIELD_' || idx);
-- field_types
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_1' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'textfield';
UPDATE fields SET field_types_id = 'FIELD_TYPE_1' WHERE (select mode from field_types where id = fields.field_types_id) = 'textfield';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_2' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'textarea';
UPDATE fields SET field_types_id = 'FIELD_TYPE_2' WHERE (select mode from field_types where id = fields.field_types_id) = 'textarea';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_3' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'email';
UPDATE fields SET field_types_id = 'FIELD_TYPE_3' WHERE (select mode from field_types where id = fields.field_types_id) = 'email';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_4' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'phone';
UPDATE fields SET field_types_id = 'FIELD_TYPE_4' WHERE (select mode from field_types where id = fields.field_types_id) = 'phone';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_5' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'attachment';
UPDATE fields SET field_types_id = 'FIELD_TYPE_5' WHERE (select mode from field_types where id = fields.field_types_id) = 'attachment';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_6' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'password';
UPDATE fields SET field_types_id = 'FIELD_TYPE_6' WHERE (select mode from field_types where id = fields.field_types_id) = 'password';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_7' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'date';
UPDATE fields SET field_types_id = 'FIELD_TYPE_7' WHERE (select mode from field_types where id = fields.field_types_id) = 'date';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_8' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'number';
UPDATE fields SET field_types_id = 'FIELD_TYPE_8' WHERE (select mode from field_types where id = fields.field_types_id) = 'number';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_9' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'url';
UPDATE fields SET field_types_id = 'FIELD_TYPE_9' WHERE (select mode from field_types where id = fields.field_types_id) = 'url';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_10' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'pin';
UPDATE fields SET field_types_id = 'FIELD_TYPE_10' WHERE (select mode from field_types where id = fields.field_types_id) = 'pin';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_11' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'account-type';
UPDATE fields SET field_types_id = 'FIELD_TYPE_11' WHERE (select mode from field_types where id = fields.field_types_id) = 'account-type';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_12' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'card-type';
UPDATE fields SET field_types_id = 'FIELD_TYPE_12' WHERE (select mode from field_types where id = fields.field_types_id) = 'card-type';
UPDATE classes_template_fields SET field_types_id = 'FIELD_TYPE_13' WHERE (select mode from field_types where id = classes_template_fields.field_types_id) = 'currency';
UPDATE fields SET field_types_id = 'FIELD_TYPE_13' WHERE (select mode from field_types where id = fields.field_types_id) = 'currency';
UPDATE field_types SET id = 'FIELD_TYPE_1' WHERE mode = 'textfield';
UPDATE field_types SET id = 'FIELD_TYPE_2' WHERE mode = 'textarea';
UPDATE field_types SET id = 'FIELD_TYPE_3' WHERE mode = 'email';
UPDATE field_types SET id = 'FIELD_TYPE_4' WHERE mode = 'phone';
UPDATE field_types SET id = 'FIELD_TYPE_5' WHERE mode = 'attachment';
UPDATE field_types SET id = 'FIELD_TYPE_6' WHERE mode = 'password';
UPDATE field_types SET id = 'FIELD_TYPE_7' WHERE mode = 'date';
UPDATE field_types SET id = 'FIELD_TYPE_8' WHERE mode = 'number';
UPDATE field_types SET id = 'FIELD_TYPE_9' WHERE mode = 'url';
UPDATE field_types SET id = 'FIELD_TYPE_10' WHERE mode = 'pin';
UPDATE field_types SET id = 'FIELD_TYPE_11' WHERE mode = 'account-type';
UPDATE field_types SET id = 'FIELD_TYPE_12' WHERE mode = 'card-type';
UPDATE field_types SET id = 'FIELD_TYPE_13' WHERE mode = 'currency';
-- POST-MIGRATION Fixed ID for Default Elements: END
-- POST-MIGRATION CLEANUP: BEGIN
-------------------------------------------- 1. DROP ALL OLD TABLES -----------------------------------------------
DROP TABLE IF EXISTS setting;
DROP TABLE IF EXISTS category;
DROP TABLE IF EXISTS template_category;
DROP TABLE IF EXISTS item;
DROP TABLE IF EXISTS template_item;
DROP TABLE IF EXISTS field;
DROP TABLE IF EXISTS template_field;
DROP TABLE IF EXISTS template_master_field;
DROP TABLE IF EXISTS field_type;
-- POST-MIGRATION CLEANUP: END
|
-- phpMyAdmin SQL Dump
-- version 4.4.0
-- http://www.phpmyadmin.net
--
-- Client : localhost:8889
-- Généré le : Mer 06 Juillet 2016 à 22:15
-- Version du serveur : 5.5.38
-- Version de PHP : 5.5.14
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Base de données : `wizardalley`
--
--
-- Contenu de la table `wizard_user`
--
INSERT INTO `wizard_user` (`id`, `username`, `username_canonical`, `email`, `email_canonical`, `enabled`, `salt`, `password`, `last_login`, `locked`, `expired`, `expires_at`, `confirmation_token`, `password_requested_at`, `roles`, `credentials_expired`, `credentials_expire_at`, `lastname`, `firstname`, `path_profile`, `path_couverture`, `twitter`, `facebook`, `sexe`) VALUES
(2, 'admin', 'admin', 'yunai39@gmail.com', 'yunai39@gmail.com', 1, 'tlfxbhjrrlwkog8s40c4o8occgg0kwg', 'jlxj+OHfQHuTv5KZwRYLnmuak1tKdKFlLp4t+U9MU9Do4LkgBGujsOGTd956/mlw8+5e/StwyDvAyUYIDOlHOg==', '2016-07-06 21:36:07', 0, 0, NULL, NULL, NULL, 'a:1:{i:0;s:10:"ROLE_ADMIN";}', 0, NULL, 'admin', 'AA', 'profile.jpg', 'couverture.jpg', 'm', 'j', 1),
(3, 'Toto', 'toto', 'toto@totolan.com', 'toto@totolan.com', 1, '58ohmoy3piscooksc08c884gcc0wo8g', 'MpjquOPsK7SKfm07YCVHyGPpvemo89Gleb1MTS0M5DcsoN/M+IZ4bk/MXYhG11V/S9nut+2kSlwlU5yXwRqVeA==', '2016-06-25 21:23:22', 0, 0, NULL, NULL, NULL, 'a:0:{}', 0, NULL, 'toto', 'toto', 'profile.png', NULL, '', '', 0),
(4, 'admin2', 'admin2', 'admin2@admin.com', 'admin2@admin.com', 1, 'tlfxbhjrrlwkog8s40c4o8occgg0kwg', 'jlxj+OHfQHuTv5KZwRYLnmuak1tKdKFlLp4t+U9MU9Do4LkgBGujsOGTd956/mlw8+5e/StwyDvAyUYIDOlHOg==', '2015-09-26 17:01:34', 0, 0, NULL, NULL, NULL, 'a:1:{i:0;s:10:"ROLE_ADMIN";}', 0, NULL, 'admin', 'AA', NULL, NULL, '', '', 0),
(5, 'Toto2', 'toto2', 'toto2@totolan.com', 'toto2@totolan.com', 1, '58ohmoy3piscooksc08c884gcc0wo8g', 'MpjquOPsK7SKfm07YCVHyGPpvemo89Gleb1MTS0M5DcsoN/M+IZ4bk/MXYhG11V/S9nut+2kSlwlU5yXwRqVeA==', '2015-07-30 20:40:18', 0, 0, NULL, NULL, NULL, 'a:0:{}', 0, NULL, 'toto', 'toto', NULL, NULL, '', '', 0),
(8, 'Toto3', 'toto3', 'toto3@totolan.com', 'toto3@totolan.com', 1, '58ohmoy3piscooksc08c884gcc0wo8g', 'MpjquOPsK7SKfm07YCVHyGPpvemo89Gleb1MTS0M5DcsoN/M+IZ4bk/MXYhG11V/S9nut+2kSlwlU5yXwRqVeA==', '2015-09-30 22:16:17', 0, 0, NULL, NULL, NULL, 'a:0:{}', 0, NULL, 'toto', 'toto', NULL, NULL, '', '', 0),
(9, 'Toto4', 'Toto4', 'Toto4@totolan.com', 'Toto4@totolan.com', 1, '58ohmoy3piscooksc08c884gcc0wo8g', 'MpjquOPsK7SKfm07YCVHyGPpvemo89Gleb1MTS0M5DcsoN/M+IZ4bk/MXYhG11V/S9nut+2kSlwlU5yXwRqVeA==', '2015-07-30 20:40:18', 0, 0, NULL, NULL, NULL, 'a:0:{}', 0, NULL, 'toto', 'toto', NULL, NULL, '', '', 0),
(10, 'qwerty', 'qwerty', 'qwerty@hew.com', 'qwerty@hew.com', 1, 'g1znxwrgvk848ok8g4csk08kgwkkgco', 'B12xG/x4FRtZgANcW+YwgluBAB29yxcV5daMisaQdbbAtXE6DNyANpMf/20zF+aKLi0oiyh6yDm4SHpves/Rog==', '2015-08-13 22:16:02', 0, 0, NULL, NULL, NULL, 'a:0:{}', 0, NULL, 'qwerty', 'qwerty', NULL, NULL, NULL, NULL, 0);
|
CREATE procedure sp_acc_updateclosingbalance(@bankaccountid int,
@balancedate datetime,@debit decimal(18,6),@credit decimal(18,6),
@transactiondate datetime)
as
If exists(Select Top 1 BankAccountID from BankClosingBalance where BankAccountID = @bankaccountid
and dbo.stripdatefromtime(BalanceDate) = @balancedate)
Begin
update BankClosingBalance
Set Debit = @debit,
Credit = @credit
where BankAccountID = @bankaccountid
and dbo.stripdatefromtime(BalanceDate) = @balancedate
End
Else
Begin
Insert BankClosingBalance (BankAccountID,
BalanceDate,
Debit,
Credit,
TransactionDate)
Values(@bankaccountid,
@balancedate,
@debit,
@credit,
@transactiondate)
End
|
-- Bot configuration schema
# --- !Ups
CREATE TABLE users (
id VARCHAR(255) NOT NULL,
first_name VARCHAR(255) NOT NULL,
last_name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL
);
# --- !Downs
DROP TABLE if EXISTS users;
|
SELECT [Examiner's Supervisor], [Supervisor Name], [SupervisorEmail], COUNT([Supervisor Name])
FROM OSHA.dbo.OCE
WHERE [Supervisoremail] IS NULL
AND [Supervisor Name] <> ''
GROUP BY [Supervisor Name], [Examiner's Supervisor], [SupervisorEmail]
ORDER BY COUNT([Supervisor Name]) DESC |
/*
BSA Application Schema
David Tompkins
9.20.2007
*/
-- Evolution Genetic/Neural Schema
drop table if exists evolutions;
create table evolutions (
id int not null auto_increment,
type varchar(100) not null,
description varchar(100) not null,
start_at datetime null,
end_at datetime null,
status int null,
iteration int null,
primary key (id)
);
drop table if exists phenotypes;
create table phenotypes (
id int not null auto_increment,
type varchar(100) not null,
description varchar(100) not null,
created_at datetime null,
total_samples int not null,
total_correct int not null,
total_false_positive int not null,
mean_class_error float not null,
mean_correct_probability float not null,
mean_correct_variance float not null,
mean_correct_pairwise_variance float not null,
mean_incorrect_probability float not null,
mean_incorrect_variance float not null,
mean_incorrect_pairwise_variance float not null,
primary key (id)
);
drop table if exists generations;
create table generations (
id int not null auto_increment,
type varchar(100) not null,
description varchar(100) not null,
start_at datetime null,
end_at datetime null,
status int null,
iteration int null,
evolution_id int null,
phenotype_id int null,
constraint fk_generations_evolution foreign key (evolution_id) references evolutions(id),
constraint fk_generations_phenotype foreign key (phenotype_id) references phenotypes(id),
primary key (id)
);
drop table if exists networks;
create table networks (
id int not null auto_increment,
type varchar(100) not null,
xml longtext not null,
created_at datetime null,
phenotype_id int null default null,
constraint fk_networks_phenotype foreign key (phenotype_id) references phenotypes(id),
primary key (id)
);
-- Stock Sample Schema
drop table if exists load_reports;
create table load_reports (
id int not null auto_increment,
num_items int null,
start_at datetime null,
end_at datetime null,
primary key (id)
);
drop table if exists tickers;
create table tickers (
id int not null auto_increment,
name varchar(10) not null,
primary key (id),
index (name)
);
drop table if exists samples;
create table samples (
id int not null auto_increment,
ticker_id int not null,
sample_date date not null,
open_price float not null,
high_price float not null,
low_price float not null,
close_price float not null,
volume bigint not null,
adj_close_price float not null,
created_at datetime null,
updated_at datetime null,
primary key (id),
constraint fk_samples_ticker foreign key (ticker_id) references tickers(id),
unique (ticker_id,sample_date),
index (ticker_id,sample_date),
index (ticker_id)
);
drop table if exists users;
create table users (
id int not null auto_increment,
name varchar(100) not null,
hashed_password char(40) null,
primary key (id)
);
lock tables load_reports write;
insert into load_reports values(
'1', #id
'1', #num_items
'2007-05-24 06:00:00', #start_at
'2007-05-24 06:01:00'); #end_at
unlock tables;
lock tables users write;
insert into users values(
null, # id
'test21', # name
'ded1b9400958eed750245018efc12698047ad7e7'); # hashed password
unlock tables;
lock tables tickers write;
insert into tickers values(
'1', #id
'TEST'); #name
unlock tables;
lock tables samples write;
insert into samples values(
"DEFAULT", #id
'1', #ticker_id
'1970-01-01', #sample_date
'1.0', #open_price
'1.0', #high_price
'1.0', #low_price
'1.0', #close_price
'1', #volume
'1.0', #adj_close_price
'2007-05-06 06:00:00', #created_at
'2007-05-06 06:00:00'); #updated_at
insert into samples values(
"DEFAULT", #id
'1', #ticker_id
'1970-01-02', #sample_date
'1.0', #open_price
'1.0', #high_price
'1.0', #low_price
'1.0', #close_price
'1', #volume
'1.1', #adj_close_price
'2007-05-06 06:00:00', #created_at
'2007-05-06 06:00:00'); #updated_at
insert into samples values(
"DEFAULT", #id
'1', #ticker_id
'1970-01-03', #sample_date
'1.0', #open_price
'1.0', #high_price
'1.0', #low_price
'1.0', #close_price
'1', #volume
'1.0', #adj_close_price
'2007-05-06 06:00:00', #created_at
'2007-05-06 06:00:00'); #updated_at
insert into samples values(
"DEFAULT", #id
'1', #ticker_id
'1970-01-04', #sample_date
'1.0', #open_price
'1.0', #high_price
'1.0', #low_price
'1.0', #close_price
'1', #volume
'1.1', #adj_close_price
'2007-05-06 06:00:00', #created_at
'2007-05-06 06:00:00'); #updated_at
insert into samples values(
"DEFAULT", #id
'1', #ticker_id
'1970-01-05', #sample_date
'1.0', #open_price
'1.0', #high_price
'1.0', #low_price
'1.0', #close_price
'1', #volume
'1.0', #adj_close_price
'2007-05-06 06:00:00', #created_at
'2007-05-06 06:00:00'); #updated_at
insert into samples values(
"DEFAULT", #id
'1', #ticker_id
'1970-01-06', #sample_date
'1.0', #open_price
'1.0', #high_price
'1.0', #low_price
'1.0', #close_price
'1', #volume
'1.1', #adj_close_price
'2007-05-06 06:00:00', #created_at
'2007-05-06 06:00:00'); #updated_at
unlock tables;
|
CREATE DATABASE books CHARACTER SET utf8 COLLATE utf8_general_ci;
use books;
-- DROP TABLE author;
-- DROP TABLE genre;
-- DROP TABLE book;
-- DROP TABLE comment;
CREATE TABLE IF NOT EXISTS author (
id VARCHAR(255) PRIMARY KEY,
first_name VARCHAR(100),
last_name VARCHAR(100)
) ENGINE=InnoDB;
CREATE INDEX author_last_name on author(last_name);
CREATE TABLE IF NOT EXISTS genre (
id VARCHAR(100) primary key,
title VARCHAR(255),
active INT DEFAULT 0
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS book (
id INT PRIMARY KEY,
author_id VARCHAR(255),
title VARCHAR(255),
url VARCHAR(255),
annotation TEXT,
genre VARCHAR(100),
publisher VARCHAR(255),
year VARCHAR(255),
isbn VARCHAR(255),
lang VARCHAR(20) DEFAULT 'ru',
views INT DEFAULT 0,
rating DECIMAL(4.2) DEFAULT '0.00',
has_image INT DEFAULT 0,
removed INT DEFAULT 0
) ENGINE=InnoDB;
CREATE INDEX book_author_id on book(author_id);
CREATE INDEX book_genre on book(genre);
CREATE INDEX book_rating_desc on book(rating DESC);
CREATE TABLE IF NOT EXISTS comment (
id INT auto_increment PRIMARY KEY,
book_id INT,
login VARCHAR(255),
comment TEXT,
created BIGINT
) ENGINE=InnoDB;
CREATE INDEX comment_book_id_created_login on comment(book_id, login);
CREATE INDEX comment_created_desc on comment(created desc);
CREATE TABLE IF NOT EXISTS grade (
id INT auto_increment PRIMARY KEY,
book_id INT,
login VARCHAR(255),
grade INT,
created BIGINT
) ENGINE=InnoDB;
CREATE INDEX grade_book_id_created_login on grade(book_id, login);
INSERT INTO `genre` (`id`, `title`, `active`) VALUES
('accounting', 'Бухучет и аудит', 0),
('adv-animal', 'Природа и животные', 0),
('adv-geo', 'Путешествия и география', 0),
('adv-history', 'Исторические приключения', 0),
('adv-indian', 'Приключения про индейцев', 0),
('adv-maritime', 'Морские приключения', 0),
('adv-western', 'Вестерн', 0),
('adventure', 'Приключения: прочее', 1),
('antique', 'Старинная литература: прочее', 0),
('antique-ant', 'Античная литература', 0),
('antique-east', 'Древневосточная литература', 0),
('antique-european', 'Древнеевропейская литература', 0),
('antique-myths', 'Мифы. Легенды. Эпос', 0),
('antique-russian', 'Древнерусская литература', 0),
('aphorisms', 'Афоризмы', 0),
('architecture-book', 'Архитектура', 0),
('astrology', 'Астрология', 0),
('auto-regulations', 'Автомобили и ПДД', 0),
('banking', 'Банковское дело', 0),
('child-adv', 'Детские приключения', 0),
('child-det', 'Детские остросюжетные', 0),
('child-education', 'Образовательная литература', 0),
('child-folklore', 'Детский фольклор', 0),
('child-prose', 'Детская проза', 0),
('child-sf', 'Детская фантастика', 0),
('child-tale', 'Сказка', 0),
('child-verse', 'Детские стихи', 0),
('children', 'Детская литература: прочее', 1),
('cine', 'Кино', 0),
('comedy', 'Комедия', 0),
('comp-db', 'Базы данных', 0),
('comp-dsp', 'Цифровая обработка сигналов', 0),
('comp-hard', 'Аппаратное обеспечение', 0),
('comp-osnet', 'ОС и Сети', 0),
('comp-programming', 'Программирование', 0),
('comp-soft', 'Программы', 0),
('comp-www', 'Интернет', 0),
('computers', 'Околокомпьютерная литература', 0),
('design', 'Искусство и Дизайн', 1),
('det-action', 'Боевик', 0),
('det-classic', 'Классический детектив', 0),
('det-cozy', 'Дамский детективный роман', 0),
('det-crime', 'Криминальный детектив', 0),
('det-espionage', 'Шпионский детектив', 0),
('det-hard', 'Крутой детектив', 0),
('det-history', 'Исторический детектив', 0),
('det-irony', 'Иронический детектив', 0),
('det-maniac', 'Маньяки', 0),
('det-police', 'Полицейский детектив', 0),
('det-political', 'Политический детектив', 0),
('detective', 'Детективы: прочее', 1),
('dissident', 'Антисоветская литература', 0),
('drama', 'Драма', 0),
('dramaturgy', 'Драматургия: прочее', 1),
('economics', 'Экономика', 0),
('epic', 'Былины', 0),
('epic-poetry', 'Эпическая поэзия', 0),
('epistolary-fiction', 'Эпистолярная проза', 0),
('essay', 'Эссе, очерк, этюд, набросок', 0),
('experimental-poetry', 'Экспериментальная поэзия', 0),
('extravaganza', 'Феерия', 0),
('fable', 'Басни', 0),
('fairy-fantasy', 'Сказочная фантастика', 0),
('fanfiction', 'Фанфик', 0),
('folk-songs', 'Народные песни', 0),
('folk-tale', 'Народные сказки', 0),
('folklore', 'Фольклор: прочее', 0),
('foreign-language', 'Иностранные языки', 0),
('geo-guides', 'Путеводители', 0),
('global-economy', 'Внешняя торговля', 0),
('gothic-novel', 'Готический роман', 0),
('great-story', 'Повесть', 0),
('historical-fantasy', 'Историческое фэнтези', 0),
('home', 'Домоводство', 1),
('home-collecting', 'Коллекционирование', 0),
('home-cooking', 'Кулинария', 0),
('home-crafts', 'Хобби и ремесла', 0),
('home-diy', 'Сделай сам', 0),
('home-entertain', 'Развлечения', 0),
('home-garden', 'Сад и огород', 0),
('home-health', 'Здоровье', 0),
('home-pets', 'Домашние животные', 0),
('home-sex', 'Эротика, Секс', 0),
('home-sport', 'Спорт', 0),
('humor', 'Юмор: прочее', 1),
('humor-anecdote', 'Анекдоты', 0),
('humor-fantasy', 'Юмористическое фэнтези', 0),
('humor-prose', 'Юмористическая проза', 0),
('humor-satire', 'Сатира', 0),
('humor-verse', 'Юмористические стихи', 0),
('in-verse', 'в стихах', 0),
('industries', 'Отраслевые издания', 0),
('job-hunting', 'Поиск работы, карьера', 0),
('limerick', 'Частушки, прибаутки, потешки', 0),
('love', 'О любви', 1),
('love-contemporary', 'Современные любовные романы', 0),
('love-detective', 'Любовные детективы', 0),
('love-erotica', 'Эротика', 0),
('love-hard', 'Порно', 0),
('love-history', 'Исторические любовные романы', 0),
('love-sf', 'Любовная фантастика', 0),
('love-short', 'Короткие любовные романы', 0),
('lyrics', 'Лирика', 0),
('management', 'Управление, подбор персонала', 0),
('marketing', 'Маркетинг, PR, реклама', 0),
('military', 'Военное дело: прочее', 0),
('military-arts', 'Боевые искусства', 0),
('military-history', 'Военная история', 0),
('military-special', 'Спецслужбы ', 0),
('military-weapon', 'Военная техника и вооружение', 0),
('music', 'Музыка', 0),
('mystery', 'Мистерия', 1),
('nonf-biography', 'Биографии и Мемуары', 0),
('nonf-criticism', 'Критика', 0),
('nonf-military', 'Военная документалистика', 0),
('nonf-publicism', 'Публицистика', 0),
('nonfiction', 'Документальная литература', 1),
('notes', 'Партитуры', 0),
('nsf', 'Ненаучная фантастика', 0),
('org-behavior', 'Корпоративная культура', 0),
('other', 'Неотсортированное', 1),
('palindromes', 'Палиндромы', 0),
('palmistry', 'Хиромантия', 0),
('paper-work', 'Делопроизводство', 0),
('periodic', 'Газеты и журналы', 0),
('personal-finance', 'Личные финансы', 0),
('poetry', 'Поэзия: прочее', 1),
('popadanec', 'Попаданцы', 0),
('popular-business', 'О бизнесе популярно', 0),
('prose', 'Проза', 1),
('prose-classic', 'Классическая проза', 0),
('prose-contemporary', 'Современная проза', 0),
('prose-counter', 'Контркультура', 0),
('prose-epic', 'Эпопея', 0),
('prose-game', 'Книга-игра', 0),
('prose-history', 'Историческая проза', 0),
('prose-magic', 'Магический реализм', 0),
('prose-military', 'О войне', 0),
('prose-rus-classic', 'Русская классическая проза', 0),
('prose-sentimental', 'Сентиментальная проза', 0),
('prose-su-classics', 'Советская классическая проза', 0),
('proverbs', 'Пословицы, поговорки', 0),
('psy-childs', 'Детская психология', 0),
('psy-sex-and-family', 'Секс и семейная психология', 0),
('psy-theraphy', 'Психотерапия и консультирование', 0),
('real-estate', 'Недвижимость', 0),
('ref-dict', 'Словари', 0),
('ref-encyc', 'Энциклопедии', 0),
('ref-guide', 'Руководства', 0),
('ref-ref', 'Справочники', 0),
('reference', 'Справочная литература', 1),
('religion', 'Религиозная литература: прочее', 1),
('religion-budda', 'Буддизм', 0),
('religion-catholicism', 'Католицизм', 0),
('religion-christianity', 'Христианство', 0),
('religion-esoterics', 'Эзотерика', 0),
('religion-hinduism', 'Индуизм', 0),
('religion-islam', 'Ислам', 0),
('religion-judaism', 'Иудаизм', 0),
('religion-orthodoxy', 'Православие', 0),
('religion-paganism', 'Язычество', 0),
('religion-protestantism', 'Протестантизм ', 0),
('religion-rel', 'Религия', 0),
('religion-self', 'Самосовершенствование', 0),
('riddles', 'Загадки', 0),
('roman', 'Роман', 0),
('sagas', 'Семейный роман/Семейная сага', 0),
('scenarios', 'Сценарии', 0),
('sci-abstract', 'Рефераты', 0),
('sci-anachem', 'Аналитическая химия', 0),
('sci-biochem', 'Биохимия', 0),
('sci-biology', 'Биология', 0),
('sci-biophys', 'Биофизика', 0),
('sci-botany', 'Ботаника', 0),
('sci-build', 'Строительство и сопромат', 0),
('sci-business', 'Деловая литература', 0),
('sci-chem', 'Химия', 0),
('sci-cosmos', 'Астрономия и Космос', 0),
('sci-crib', 'Шпаргалки', 0),
('sci-culture', 'Культурология', 0),
('sci-ecology', 'Экология', 0),
('sci-economy', 'Экономика', 0),
('sci-geo', 'Геология и география', 0),
('sci-history', 'История', 0),
('sci-juris', 'Юриспруденция', 0),
('sci-linguistic', 'Языкознание', 0),
('sci-math', 'Математика', 0),
('sci-medicine', 'Медицина', 0),
('sci-medicine-alternative', 'Альтернативная медицина', 0),
('sci-metal', 'Металлургия', 0),
('sci-orgchem', 'Органическая химия', 0),
('sci-pedagogy', 'Педагогика', 0),
('sci-philology', 'Литературоведение', 0),
('sci-philosophy', 'Философия', 0),
('sci-phys', 'Физика', 0),
('sci-physchem', 'Физическая химия', 0),
('sci-politics', 'Политика', 0),
('sci-popular', 'Научпоп', 0),
('sci-psychology', 'Психология', 0),
('sci-radio', 'Радиоэлектроника', 0),
('sci-religion', 'Религиоведение', 0),
('sci-social-studies', 'Обществознание', 0),
('sci-state', 'Государство и право', 0),
('sci-tech', 'Технические науки', 0),
('sci-textbook', 'Учебники', 0),
('sci-transport', 'Транспорт и авиация', 0),
('sci-veterinary', 'Ветеринария', 0),
('sci-zoo', 'Зоология', 0),
('science', 'Научная литература: прочее', 1),
('screenplays', 'Киносценарии', 0),
('sf', 'Научная фантастика', 1),
('sf-action', 'Боевая фантастика', 0),
('sf-cyberpunk', 'Киберпанк', 0),
('sf-detective', 'Детективная фантастика', 0),
('sf-epic', 'Эпическая фантастика', 0),
('sf-etc', 'Фантастика: прочее', 0),
('sf-fantasy', 'Фэнтези', 0),
('sf-fantasy-city', 'Городское фэнтези', 0),
('sf-fantasy-irony', 'Ироническое фэнтези', 0),
('sf-heroic', 'Героическая фантастика', 0),
('sf-history', 'Альтернативная история', 0),
('sf-horror', 'Ужасы', 0),
('sf-humor', 'Юмористическая фантастика', 0),
('sf-irony', 'Ироническая фантастика', 0),
('sf-mystic', 'Мистика', 0),
('sf-postapocalyptic', 'Постапокалипсис', 0),
('sf-social', 'Социальная фантастика', 0),
('sf-space', 'Космическая фантастика', 0),
('sf-space-opera', 'Космоопера', 0),
('sf-stimpank', 'Стимпанк', 0),
('sf-technofantasy', 'Технофэнтези', 0),
('short-story', 'Рассказ', 0),
('small-business', 'Малый бизнес', 0),
('song-poetry', 'Песенная поэзия', 0),
('stock', 'Ценные бумаги, инвестиции', 0),
('story', 'Новелла', 0),
('theatre', 'Театр', 0),
('thriller', 'Триллер', 1),
('thriller-legal', 'Юридический триллер', 0),
('thriller-medical', 'Медицинский триллер', 0),
('thriller-techno', 'Техно триллер', 0),
('trade', 'Торговля', 0),
('tragedy', 'Трагедия', 0),
('unfinished', 'Недописанное', 0),
('vaudeville', 'Водевиль', 0),
('vers-libre', 'Верлибры', 0),
('visual-arts', 'Изобразительное искусство, фотография', 0),
('visual-poetry', 'Визуальная поэзия', 0),
('ya', 'Подростковая литература', 0);
update genre set active = 1 where exists(select 1 from book where book.genre = genre.id);
|
SELECT customerName as "Customer Name", CONCAT(employees.lastName, ", ", employees.firstName) as "Sales Rep Name"
FROM customers
INNER JOIN employees
ON customers.salesRepEmployeeNumber=employees.employeeNumber
ORDER BY customerName ASC
|
/*
Misc. query for finding any expression port using SUBSTR.
Can be extended for any inline SQL statements. Very useful.
Part of standardization project; also a tool shared with developers.
Informatica PC 9.6.1
*/
SELECT DISTINCT REP_ALL_MAPPINGS.SUBJECT_AREA
, REP_ALL_MAPPINGS.MAPPING_NAME
, REP_WIDGET_INST.WIDGET_TYPE_NAME AS TRANSFORMATION_TYPE
, REP_WIDGET_INST.INSTANCE_NAME AS TRANSFORMATION_NAME
, REP_WIDGET_FIELD.FIELD_NAME AS PORT_NAME,
CASE
WHEN REP_WIDGET_FIELD.PORTTYPE = 1 THEN 'I'
WHEN REP_WIDGET_FIELD.PORTTYPE = 2 THEN 'O'
WHEN REP_WIDGET_FIELD.PORTTYPE = 3 THEN 'IO'
WHEN REP_WIDGET_FIELD.PORTTYPE = 32 THEN 'V'
END AS PORT_TYPE,
REP_WIDGET_FIELD.EXPRESSION
FROM PC_REPO.REP_WIDGET_INST REP_WIDGET_INST
, PC_REPO.REP_WIDGET_FIELD REP_WIDGET_FIELD
, PC_REPO.REP_ALL_MAPPINGS REP_ALL_MAPPINGS
WHERE REP_WIDGET_INST.WIDGET_ID = REP_WIDGET_FIELD.WIDGET_ID
AND REP_WIDGET_INST.MAPPING_ID = REP_ALL_MAPPINGS.MAPPING_ID
AND REP_WIDGET_INST.WIDGET_TYPE = 5
AND UPPER(REP_WIDGET_FIELD.EXPRESSION) LIKE '%SUBSTR%'
ORDER BY 1
|
UPDATE Reports
SET CloseDate = GETDATE()
WHERE CloseDate IS NULL
DELETE Reports
WHERE StatusId=4 |
/*
Name : spGetIdForProgressEntry
Object Type: STORED PROCEDURE
Dependency :
TABLE:
- PROGRESS
STORED PROCEDURE :
- spGetObjectId
*/
use BIGGYM;
drop procedure if exists spGetIdForProgressEntry;
delimiter $$
create procedure spGetIdForProgressEntry(in vSetOrdinality tinyint unsigned,
in vSetReps tinyint unsigned,
in vSetWeight double,
in vSetDatestamp datetime,
in vPlanDefinitionId mediumint unsigned,
out ObjectId mediumint unsigned,
out ReturnCode int)
begin
-- Declare ..
declare ObjectName varchar(128) default 'PROGRESS';
-- Prepare ..
set @getIdWhereClause = concat( ' SET_ORDINALITY = ', vSetOrdinality,
' and SET_REPS = ', vSetReps,
' and SET_WEIGHT = ', vSetWeight,
' and SET_DATE = ''', vSetDatestamp, '''',
' and DEFINITIONid = ', vPlanDefinitionId
);
-- Get ..
call spGetObjectId (ObjectName, @getIdWhereClause, ObjectId, ReturnCode);
end$$
delimiter ;
|
DROP TABLE IF EXISTS db_version;
CREATE TABLE db_version (version INTEGER);
INSERT INTO db_version (version) VALUES (51);
DROP TABLE IF EXISTS user;
CREATE TABLE user (
id TEXT(50) PRIMARY KEY NOT NULL,
email TEXT,
name TEXT UNIQUE NOT NULL,
permissions_json TEXT NOT NULL
);
CREATE INDEX IF NOT EXISTS user_email_index ON user(email);
INSERT INTO user
(id, email, name, permissions_json) VALUES
('admin', 'turniere@aufschlagwechsel.de', 'aufschlagwechsel.de', '["admin"]');
INSERT INTO user
(id, email, name, permissions_json) VALUES
('hobby', 'bmtmgr_hobby@aufschlagwechsel.de', 'Hobby', '[]');
DROP TABLE IF EXISTS login_email_token;
CREATE TABLE login_email_token (
token TEXT PRIMARY KEY,
user_id TEXT,
request_time BIGINT,
expiry_time BIGINT,
metadata_json TEXT,
FOREIGN KEY(user_id) REFERENCES user(id)
);
DROP TABLE IF EXISTS login_cookie_token;
CREATE TABLE login_cookie_token (
token TEXT PRIMARY KEY,
user_id TEXT,
request_time BIGINT,
expiry_time BIGINT,
metadata_json TEXT,
FOREIGN KEY(user_id) REFERENCES user(id)
);
DROP TABLE IF EXISTS season;
CREATE TABLE season (
id INTEGER PRIMARY KEY,
name TEXT UNIQUE NOT NULL,
visible INTEGER(1) NOT NULL,
baseurl TEXT
);
CREATE INDEX IF NOT EXISTS season_name_index ON season(name);
DROP TABLE IF EXISTS player;
CREATE TABLE player (
id INTEGER PRIMARY KEY,
season_id INTEGER NOT NULL,
club_id INTEGER NOT NULL,
textid TEXT NOT NULL,
name TEXT NOT NULL,
gender TEXT(1) NOT NULL,
birth_year INTEGER,
nationality TEXT,
email TEXT,
phone TEXT,
league TEXT,
winrate REAL,
FOREIGN KEY(season_id) REFERENCES season(id),
FOREIGN KEY(club_id) REFERENCES user(id),
UNIQUE (season_id, textid)
);
CREATE INDEX IF NOT EXISTS player_textid_index ON player(textid);
DROP TABLE IF EXISTS tournament;
CREATE TABLE tournament (
id INTEGER PRIMARY KEY,
season_id INTEGER NOT NULL,
name TEXT UNIQUE NOT NULL,
description TEXT,
start_time BIGINT,
end_time BIGINT,
visible INTEGER(1),
FOREIGN KEY(season_id) REFERENCES season(id)
);
CREATE INDEX IF NOT EXISTS tournament_name_index ON tournament(name);
DROP TABLE IF EXISTS discipline;
CREATE TABLE discipline (
id INTEGER PRIMARY KEY,
tournament_id INTEGER NOT NULL,
name TEXT NOT NULL,
dtype TEXT(2) NOT NULL,
ages TEXT,
leagues TEXT,
capacity INTEGER,
note TEXT,
FOREIGN KEY(tournament_id) REFERENCES tournament(id),
UNIQUE (tournament_id, name)
);
DROP TABLE IF EXISTS entry;
CREATE TABLE entry (
id INTEGER PRIMARY KEY,
discipline_id INTEGER NOT NULL,
player_id INTEGER,
player_club_id INTEGER,
partner_id INTEGER,
partner_club_id INTEGER,
email TEXT,
created_time BIGINT,
updated_time BIGINT,
seeding INTEGER,
position BIGINT,
memo TEXT,
FOREIGN KEY(discipline_id) REFERENCES discipline(id),
FOREIGN KEY(player_id) REFERENCES player(id),
FOREIGN KEY(player_club_id) REFERENCES user(id),
FOREIGN KEY(partner_id) REFERENCES player(id),
FOREIGN KEY(partner_club_id) REFERENCES user(id),
UNIQUE (discipline_id, player_id)
);
DROP TABLE IF EXISTS publication;
CREATE TABLE publication (
id INTEGER PRIMARY KEY,
tournament_id INTEGER,
ptype TEXT,
config TEXT,
FOREIGN KEY(tournament_id) REFERENCES tournament(id)
); |
CREATE DEFINER=`dba`@`%` PROCEDURE `INCLUIR_ARTISTA`(OUT P_ID_ARTISTA INT,
IN P_ART_NOME VARCHAR(255),
IN P_ART_LINK_FOTO VARCHAR(500),
IN P_COMMIT CHAR(1),
OUT P_OK CHAR(1),
OUT P_RETORNO VARCHAR(2000))
INCLUIR_ARTISTA:BEGIN
DECLARE V_ID_ARTISTA INT;
CALL VALIDA_CAMPO_OBRIGATORIO(P_ART_NOME, 'ARTISTA', 'ART_NOME', P_OK, P_RETORNO);
IF P_OK = 'N' THEN
LEAVE INCLUIR_ARTISTA;
END IF;
SELECT A.ID_ARTISTA
INTO V_ID_ARTISTA FROM ARTISTA A
WHERE UPPER(TRIM(A.ART_NOME)) = UPPER(TRIM(P_ART_NOME));
IF V_ID_ARTISTA IS NOT NULL THEN
CALL MSG_ERRO('ARTISTA_EXISTE', P_ART_NOME, NULL, NULL, NULL, NULL, P_OK, P_RETORNO);
-- O artista :param1 já existe.
LEAVE INCLUIR_ARTISTA;
END IF;
-- incluir artista
INSERT INTO ARTISTA(ART_NOME, ART_LINK_FOTO)
VALUES(P_ART_NOME, P_ART_LINK_FOTO);
CALL MSG_SUCESSO('INCLUIR_ARTISTA', P_ART_NOME, NULL,NULL,NULL,NULL, P_OK, P_RETORNO);
-- O artista :param1 foi cadastrado com sucesso.
IF P_OK = 'N' THEN
LEAVE INCLUIR_ARTISTA;
END IF;
IF IFNULL(P_COMMIT,'N') = 'S'THEN
COMMIT;
END IF;
-- retorna o id do artista cadastrado
SET P_ID_ARTISTA := LAST_INSERT_ID();
END |
# Write your MySQL query statement below
SELECT wt1.Id
FROM Weather wt1, Weather wt2
WHERE wt1.Temperature > wt2.Temperature AND
TO_DAYS(wt1.RecordDate)-TO_DAYS(wt2.RecordDate)=1; |
USE ResidentialLife
CREATE TABLE dbo.GuestLog(
GuestLogId INT IDENTITY(1,1) PRIMARY KEY,
GuestName VARCHAR(255) NOT NULL,
StudentId INT NOT NULL,
Guest_In DATETIME NOT NULL DEFAULT GETDATE(),
Guest_Out DATETIME,
FOREIGN KEY (StudentId) REFERENCES dbo.Resident(StudentId)
);
DROP TABLE dbo.GuestLog |
CREATE procedure Sp_Acc_SaveCustDetails (@PriceListID Int,@BranchID nVarchar(50))
as
Insert into PriceListBranch (PriceListID,BranchID)
Values (@PriceListID,@BranchID)
|
SELECT
@year:=`year`,
@month:=`month`,
@customer:=`customer`,
IFNULL(sum(`value_rashod`),0) as rashod,
IFNULL(sum(`value_prihod`),0) as prihod,
( SELECT IFNULL(sum(`value`),0) as prihod FROM `income` where `customer` = @customer and (YEAR(`date`)<@year or (YEAR(`date`)=@year and MONTH(`date`)<=@month)) )
-
( SELECT IFNULL(sum(`value`),0) as rashod FROM `invoice` where `customer` = @customer and (YEAR(`date`)<@year or (YEAR(`date`)=@year and MONTH(`date`)<=@month)) )
as ost
FROM
(
SELECT YEAR(`date`) as year, MONTH(`date`) as month, `customer`, `value` as value_rashod, 0 as value_prihod FROM `invoice`
UNION
SELECT YEAR(`date`) as year, MONTH(`date`) as month, `customer`, 0 as value_rashod, `value` as value_prihod FROM `income`
) as t
group by `year`, `month`, `customer`
order by `year`, `month`, `customer` |
CREATE TABLE persons
(
id BIGINT(20) PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL,
date_of_birth DATE NOT NULL,
cpf VARCHAR(11),
email VARCHAR(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
create database hemolines;
use hemolines;
create table cadastro (
idEmpresa int primary key auto_increment,
nomeEmpresa varchar (50),
email varchar (50),
telefone varchar (40),
nacionalidade varchar (40),
cnpj char (12)
);
insert into cadastro (nomeEmpresa, email, telefone, nacionalidade, cnpj) values
('Fleury', 'contato@fleury.com', '(+55) 11-24275498', 'Brasileira', '000123450872'),
('Eurolab', 'contato@eurolab.com', '(+353) 1 804 0300', 'Irlandesa', null),
('Medbras', 'contato@medbras.com', '(+55) 11-82711498', 'Brasileira', '008291508721'),
('Hemolabs', 'contato@hemolabs.com', '(+1) 408 291 5467', 'Estadunidense', null),
('Samplefy', 'contato@samplefy.com', '(+1) 428 764 8729', 'Estadunidense', null);
select * from cadastro;
drop table cadastro;
create table cliente(
idEmpresa int primary key auto_increment,
qtdCaixas int,
qtdVeiculos int,
valorFixo double (15,2),
tempoRest time,
tempoGasto time
);
insert into cliente (qtdCaixas, qtdVeiculos, valorFixo, tempoRest, tempoGasto) values
(2, 1, '200', '27:45:25', '12:14:25'),
(3, 1, '329', '207:46:23', '67:29:34'),
(8, 3, '562', '590:39:19', '525:56:10'),
(1, 1, '120', '8:21:57', '3:01:07'),
(6, 1, '80', '2:43:26', '3:26:28');
select * from cliente;
create table sensor(
idCaixa int primary key auto_increment,
idEmpresa int,
temp float not null default 0,
dataTemp dateTime default current_timestamp
);
insert into sensor (idEmpresa, temp, dataTemp) values
(1, 2.32, '2021-02-18 10:34:00'),
(1, 4.47, '2021-02-18 10:34:00'),
(2, 3.12, '2021-02-19 7:28:00'),
(2, 9.45, '2021-02-19 7:28:00'),
(2, 5.12, '2021-02-19 7:28:00'),
(3, 6.14, '2021-02-20 9:58:00'),
(3, 1.74, '2021-02-20 9:58:00'),
(3, 2.84, '2021-02-20 9:58:00'),
(3, 9.12, '2021-02-20 9:58:00'),
(3, 5.97, '2021-02-20 9:58:00'),
(3, 8.22, '2021-02-20 9:58:00'),
(3, 7.44, '2021-02-20 9:58:00'),
(3, 4.69, '2021-02-20 9:58:00'),
(4, 6.69, '2021-02-28 8:19:00'),
(5, 1.69, '2021-03-02 9:58:00'),
(5, 1.05, '2021-03-02 9:58:00'),
(5, 3.21, '2021-03-02 9:58:00'),
(5, 2.87, '2021-03-02 9:58:00'),
(5, 5.99, '2021-03-02 9:58:00'),
(5, 3.69, '2021-03-02 9:58:00');
select * from sensor;
drop table sensor;
truncate table sensor;
|
drop table BOARD_QNA CASCADE CONSTRAINTS;
create table BOARD_QNA(
QNA_NUM NUMBER NOT NULL, --글번호
QNA_PASS VARCHAR2(20) NOT NULL, --비밀번호
QNA_SUBJECT VARCHAR2(40) NOT NULL, --제목
USER_ID VARCHAR2(50) references member(USER_ID) on delete cascade, --아이디
USER_NICKNAME VARCHAR2(50) , --닉네임
QNA_CONTENT VARCHAR2(4000) NOT NULL, --내용
QNA_FILE VARCHAR2(100), --첨부 파일 명(가공)
QNA_ORIGINAL VARCHAR2(100), --첨부 파일 명
QNA_DATE DATE NOT NULL, --등록 날짜
QNA_READCOUNT NUMBER NOT NULL, --글의 조회수
QNA_RE_REF NUMBER, --답변 글 작성시 참조되는 글의 번호
QNA_RE_LEV NUMBER CHECK(QNA_RE_LEV IN(0,1)), --답변 글의 깊이
QNA_RE_SEQ NUMBER, --답변 글의 순서
PRIMARY KEY(QNA_NUM)
);
select * from BOARD_QNA;
insert into BOARD_QNA values(1,'1234','테스트 게시물','user01', '장군', '첫 테스트 게시 내용', NULL,NULL,SYSDATE,0,0,0,0);
alter table board_qna modify QNA_SUBJECT varchar2(60);
|
INSERT INTO "ORDER"(ID, USER_ID, PAYMENT, STATUS, ADDRESS) VALUES (1, 1, 100, 0, 'shenzhen futian');
INSERT INTO ORDER_ITEM(ORDER_ID, PRODUCT_ID, AMOUNT) VALUES (1, 1, 1);
|
LOAD DATA LOCAL INFILE 'data/Users.txt' INTO TABLE Users FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Books.txt' INTO TABLE Books FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Chapters.txt' INTO TABLE Chapters FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Questions.txt' INTO TABLE Questions FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Solutions.txt' INTO TABLE Solutions FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Options.txt' INTO TABLE Options FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Users_2_Books.txt' INTO TABLE Users_2_Books FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Books_2_Chapters.txt' INTO TABLE Books_2_Chapters FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Chapters_2_Questions.txt' INTO TABLE Chapters_2_Questions FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Questions_2_Solutions.txt' INTO TABLE Questions_2_Solutions FIELDS TERMINATED BY ',';
LOAD DATA LOCAL INFILE 'data/Questions_2_Options.txt' INTO TABLE Questions_2_Options FIELDS TERMINATED BY ',';
|
CREATE DEFINER=`root`@`localhost` PROCEDURE `VerifyUser`(IN typedEmailID VARCHAR(50),IN typedpassword VARCHAR(50),
OUT total INT)
BEGIN
SELECT COUNT(EmailID)
INTO total
FROM Users
WHERE EmailID=typedEmailID
AND Loginpassword=MD5(typedpassword);
insert userdetails(Firstname,Lastname,EmailID,LastLoggedIn,LastLoggedIn2)
SELECT FirstName,LastName,EmailID,now(),now()
FROM Users
WHERE EmailID=typedEmailID
AND Loginpassword=MD5(typedpassword) AND NOT EXISTS (
SELECT 1 FROM userdetails WHERE EmailID = typedEmailID
) LIMIT 1;
update userdetails
set LastLoggedIn=LastLoggedIn2
WHERE EmailID = typedEmailID;
update userdetails
set LastLoggedIn2=now()
WHERE EmailID = typedEmailID;
SELECT total;
END |
-- Up
insert into tenant_types
values (1, 'LTD');
insert into tenant_types
values (2, 'SE');
insert into tenant_types
values (3, 'PE');
insert into tenants
values (1, 1, 'Организация 1', 'Типочек 1', 'Адрес 1', 'ИНН');
insert into contract_statuses
values (1, 'ACTIVE');
insert into contract_statuses
values (2, 'EXTENDED');
insert into contract_statuses
values (3, 'PAUSED');
insert into contract_statuses
values (4, 'CLOSED');
insert into contract_statuses
values (5, 'UNKNOWN');
insert into contract_type
values (1, 'Бюджетные помещения');
insert into contracts
values (1, 1, 1, 1, '123', '2019-01-01', '2020-01-01', null, null);
insert into contracts
values (2, 1, 2, 1, '456', '2018-02-02', '2020-01-01', null, null);
insert into contracts
values (3, 1, 3, 1, '789', '2018-03-03', '2020-01-01', null, null);
insert into contracts
values (4, 1, 4, 1, '111', '2018-04-04', '2020-01-01', null, null);
insert into contracts
values (5, 1, 5, 1, '122', '2018-05-05', '2020-01-01', null, null);
insert into contracts
values (6, 1, 2, 1, '133', '2018-06-06', '2020-01-01', null, null);
insert into contracts
values (7, 1, 2, 1, '144', '2018-07-07', '2020-01-01', null, null);
insert into contracts
values (8, 1, 2, 1, '155', '2018-08-08', '2020-01-01', null, null);
insert into contracts
values (9, 1, 2, 1, '166', '2018-09-09', '2020-01-01', null, null);
insert into contracts
values (10, 1, 2, 1, '177', '2018-10-10', '2020-01-01', null, null);
insert into contracts
values (11, 1, 2, 1, '188', '2018-11-1', '2020-01-01', null, null);
insert into contracts
values (12, 1, 2, 1, '199', '2018-12-12', '2020-01-01', null, null);
insert into finance_action_type
values (1, 'ACCRUAL'),
(2, 'ADJUSTMENT'),
(3, 'PAYMENT');
insert into finance_action
values (1, 1, 1, '2019-07-09', '2019-07-01', 300),
(2, 1, 1, '2019-08-10', '2019-08-01', 400),
(3, 1, 1, '2019-08-11', '2019-08-01', 500),
(4, 1, 1, '2019-09-12', '2019-09-01', 600),
(5, 1, 1, '2019-10-13', '2019-10-01', 700),
(6, 1, 1, '2019-11-14', '2019-11-01', 800);
insert into finance_action
values (7, 1, 2, '2019-07-09', '2019-07-01', 300),
(8, 1, 2, '2019-08-10', '2019-08-01', 400),
(9, 1, 2, '2019-08-11', '2019-08-01', 500),
(10, 1, 2, '2019-09-12', '2019-09-01', 600),
(11, 1, 2, '2019-10-13', '2019-10-01', 700),
(12, 1, 2, '2019-11-14', '2019-11-01', 800);
insert into finance_action
values (13, 1, 3, '2019-07-09', '2019-07-01', 300),
(14, 1, 3, '2019-08-10', '2019-08-01', 400),
(15, 1, 3, '2019-08-11', '2019-08-01', 500),
(16, 1, 3, '2019-09-12', '2019-09-01', 600),
(17, 1, 3, '2019-10-13', '2019-10-01', 700),
(18, 1, 3, '2019-11-14', '2019-11-01', 800);
insert into AREAS
VALUES (1, 'ЦГР');
insert into BUSINESS_TYPES
VALUES (1, 'Мясопереработка');
insert into OBJECTS
values (1, 1, 1, 1, 10,
'АСТЕЛИТ', 'ул. Жарова пожарова', null, 300, '2019-09-11', 150, '2019-09-12', '112233',
'Крайников Краник Крыжовник',
'2019-09-12', null, 'Одноэтажное здание');
insert into OBJECTS_INFORMATION
values (1, 1, 'Площадь', '20');
insert into OBJECTS_INFORMATION
values (2, 1, 'Количество стен', '3');
insert into OBJECTS_INFORMATION
values (3, 1, 'Количество потолков', '1');
insert into CONTRACT_EXTENSIONS
values (1, 1, '2019-10-01', '2019-12-12', '2019-10-01', 1000);
insert into contact_type
values (1, 'PHONE'),
(2, 'EMAIL'),
(3, 'SOCIAL'),
(4, 'UNKNOWN');
insert into CONTACTS
values (1, 1, '+380743368012', 1),
(2, 1, 'sasha@sasze.com', 2);
-- Down
delete
from contacts;
delete
from contact_type;
delete
from CONTRACT_EXTENSIONS;
delete
from OBJECTS_INFORMATION;
delete
from OBJECTS;
delete
from BUSINESS_TYPES;
delete
from AREAS;
delete
from finance_action;
delete
from finance_action_type;
delete
from contracts;
delete
from contract_type;
delete
from contract_statuses;
delete
from tenants;
delete
from tenant_types;
|
-- MariaDB dump 10.19 Distrib 10.6.4-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: db_rent_car
-- ------------------------------------------------------
-- Server version 10.6.4-MariaDB
/*!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 */;
/*!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 `tb_brand`
--
DROP TABLE IF EXISTS `tb_brand`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_brand` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT current_timestamp(),
`updatet_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_brand`
--
LOCK TABLES `tb_brand` WRITE;
/*!40000 ALTER TABLE `tb_brand` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_brand` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_car`
--
DROP TABLE IF EXISTS `tb_car`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_car` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`plat_number` varchar(8) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`price` double DEFAULT NULL,
`photo` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` bit(2) DEFAULT NULL,
`created_at` datetime DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp(),
`brand_id` int(11) DEFAULT NULL,
`type_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `brand_id` (`brand_id`),
KEY `type_id` (`type_id`),
CONSTRAINT `tb_car_ibfk_1` FOREIGN KEY (`brand_id`) REFERENCES `tb_brand` (`id`),
CONSTRAINT `tb_car_ibfk_2` FOREIGN KEY (`type_id`) REFERENCES `tb_type` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_car`
--
LOCK TABLES `tb_car` WRITE;
/*!40000 ALTER TABLE `tb_car` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_car` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_rent`
--
DROP TABLE IF EXISTS `tb_rent`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_rent` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`borrow_date` date DEFAULT NULL,
`return_date` date DEFAULT NULL,
`sub_total` double DEFAULT NULL,
`created_at` datetime DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp(),
`user_id` int(11) DEFAULT NULL,
`car_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
KEY `car_id` (`car_id`),
CONSTRAINT `tb_rent_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `tb_user` (`id`),
CONSTRAINT `tb_rent_ibfk_2` FOREIGN KEY (`car_id`) REFERENCES `tb_car` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_rent`
--
LOCK TABLES `tb_rent` WRITE;
/*!40000 ALTER TABLE `tb_rent` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_rent` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_type`
--
DROP TABLE IF EXISTS `tb_type`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` datetime DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_type`
--
LOCK TABLES `tb_type` WRITE;
/*!40000 ALTER TABLE `tb_type` DISABLE KEYS */;
/*!40000 ALTER TABLE `tb_type` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tb_user`
--
DROP TABLE IF EXISTS `tb_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`password` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`no_ktp` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`address` text COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`phone` varchar(12) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`status` bit(2) DEFAULT NULL,
`created_at` datetime DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tb_user`
--
LOCK TABLES `tb_user` WRITE;
/*!40000 ALTER TABLE `tb_user` DISABLE KEYS */;
INSERT INTO `tb_user` VALUES (1,'hadinurhidayat97@gmail.com','123123123','3211212410960002','Hadi Nurhidayat','Sumedang','085721193045','\0','2021-09-01 00:22:55','2021-09-01 00:22:55'),(2,'admin@gmail.com','123123123123','123123123','admin','bandung','12313123','','2021-09-01 00:25:26','2021-09-01 00:25:26');
/*!40000 ALTER TABLE `tb_user` 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 2021-09-01 0:50:33
|
DELIMITER //
CREATE FUNCTION mask_inner(str VARCHAR(128), margin_left INTEGER, margin_right INTEGER)
RETURNS VARCHAR(128) CHARSET utf8
NO SQL
DETERMINISTIC
BEGIN
DECLARE str_len INTEGER DEFAULT LENGTH(str);
DECLARE res_str VARCHAR(128) DEFAULT '';
IF @mask_character IS NULL THEN
SET @mask_character := 'X';
END IF;
IF margin_left < 0 OR margin_right < 0 THEN
SET res_str := NULL;
ELSEIF str_len < margin_left + margin_right THEN
SET res_str := str;
ELSE
SET res_str := CONCAT(SUBSTR(str, 1, margin_left),
REPEAT(@mask_character, str_len - margin_left - margin_right),
REVERSE(SUBSTR(REVERSE(str), 1, margin_right))
);
END IF;
RETURN res_str;
END //
DELIMITER ;
|
insert INTO area(idarea, nombre, descripcion) VALUES (1, 'matematicas', 'area de matematicas');
insert INTO area(idarea, nombre, descripcion) VALUES (2, 'algoritmos', 'area de algoritmos');
insert INTO area(idarea, nombre, descripcion) VALUES (3, 'redes', 'area de redes');
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (1, 1, 'calculo I', 'curso de ciencias basicas', '01', 3);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (2, 1, 'calculo II', 'curso de ciencias basicas', '02', 3);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (3, 1, 'calculo III', 'curso de ciencias basicas', '03', 3);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (4, 1, 'ecuaciones diferenciales', 'curso de ciencias basicas, ecuaciones', '04', 3);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (5, 2, 'logica computacional', 'conceptos basicos de programacion', '02', 3);
insert INTO asignatura(
idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (6, 2, 'Programacion I', 'Programacion basica', '03', 4);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (7, 2, 'Programacin II', 'Estructuras de datos', '04', 4);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (8, 2, 'metodos numericos', 'metodos numericos y programacion', '05', 4);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (9, 2, 'Desarrollo de software libre', 'Desarrollo de aplicacion con c#', '08', 3);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (10, 2, 'Desarrollo web', 'programacion para la web', '09', 3);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (11, 3, 'telematica', 'Introduccion a la telematica', '07', 3);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (12, 3, 'redes locales', 'configuracin de redes locales', '09', 3);
insert INTO asignatura(idasignatura, idarea, nombre, descripcion, semestre, numerocreditos)
VALUES (13, 3, 'configuracion de redes', 'configuracion de redes de area extensa', '10', 3);
insert INTO facultad(idfacultad, nombre, descripcion)
VALUES (1, 'Ciencias basicas', 'matematicas, quimica, fisica, biologia, entre otras');
insert INTO facultad(idfacultad, nombre, descripcion)
VALUES (2, 'Ingenierias', 'Ing. de sistemas, Ing. Industrial, Ing. de Alimentos, entre otros.');
insert INTO facultad(idfacultad, nombre, descripcion)
VALUES (3, 'Medicina veterinaria y zootecnia', 'veterinaria y zootecnia');
insert INTO facultad(idfacultad, nombre, descripcion)
VALUES (4, 'Ciencias agricolas', 'El campo y los alimentos');
insert INTO facultad(idfacultad, nombre, descripcion)
VALUES (5, 'Ciencias de la salud', 'la salud');
insert INTO departamento(iddpto, idfacultad, nombre, descripcion)
VALUES (1, 2, 'Ingenieria de sistemas y telecomunicaciones', 'Departamento de los ingenieros de sistemas.');
insert INTO departamento(iddpto, idfacultad, nombre, descripcion)
VALUES (2, 2, 'Ingenieria Industrial', 'Departamento de los ingenieros industriales');
insert INTO departamento(iddpto, idfacultad, nombre, descripcion)
VALUES (3, 1, 'Matematicas y estadistica', 'departamento de loquillos');
insert INTO departamento(iddpto, idfacultad, nombre, descripcion)
VALUES (4, 3, 'Medicina veterinaria y zootecnia', 'Medicos veterinarios');
insert INTO departamento(iddpto, idfacultad, nombre, descripcion)
VALUES (5, 4, 'Ingenieria Agronomica', 'departamento de agronomos');
insert INTO departamento(iddpto, idfacultad, nombre, descripcion)
VALUES (6, 4, 'Ingenieria de Alimentos', 'departamento de ingenieros de alimentos');
insert INTO departamento(iddpto, idfacultad, nombre, descripcion)
VALUES (7, 5, 'Enfermeria', 'Los enfermeros');
insert INTO departamento(iddpto, idfacultad, nombre, descripcion)
VALUES (8, 5, 'Bacteriologia', 'Bacteriologos');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (1, 1, 'Ing. de sistemas', 'programa de ing. de sistemas.');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (2, 2, 'Ing. Industrial', 'programa de ing. Industrial.');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (3, 3, 'Matematicas', 'matematicos');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (4, 3, 'Estadisticas', 'programa de estadistica');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (5, 4, 'Veterinaria', 'Medicina veterinaria');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (6, 5, 'Ing. Agronomica', 'agronomia');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (7, 6, 'Ing. Alimentos', 'Ing. de alimentos');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (8, 7, 'Enfermeria', 'Enfermeros');
insert INTO programa(idprog, iddpto, nombre, descripcion)
VALUES (9, 8, 'Bacteriologia', 'Bacteriologos');
insert INTO permiso(idpermiso, descripcion, nombrepermiso, estado)
VALUES (1, 'Permisos estudiantes activos', 'est001', '01');
insert INTO permiso(
idpermiso, descripcion, nombrepermiso, estado)
VALUES (2, 'Permisos estudiantes inactivos', 'est002', '01');
insert INTO permiso(
idpermiso, descripcion, nombrepermiso, estado)
VALUES (3, 'Permisos auxiliar para ingresar preguntas', 'est003', '01');
insert INTO permiso(
idpermiso, descripcion, nombrepermiso, estado)
VALUES (4, 'Permisos docente', 'doc001', '01');
insert INTO permiso(
idpermiso, descripcion, nombrepermiso, estado)
VALUES (5, 'Permisos preparador', 'doc002', '01');
insert INTO permiso(
idpermiso, descripcion, nombrepermiso, estado)
VALUES (6, 'Permisos administrador', 'admin001', '01');
insert INTO modulo(
codigomod, nombre, estado, descripcion)
VALUES (1, 'mod0001', 'activo', 'crear test de practica, simulacros de preparacion para estudiantes.');
insert INTO modulo(
codigomod, nombre, estado, descripcion)
VALUES (2, 'mod0002', 'activo', 'Cronograma de actividades');
insert INTO modulo(
codigomod, nombre, estado, descripcion)
VALUES (3, 'mod0003', 'activo', 'estadisticas');
insert INTO modulo(
codigomod, nombre, estado, descripcion)
VALUES (4, 'mod0004', 'activo', 'modulo de creacion de simulacros');
insert INTO modulo(
codigomod, nombre, estado, descripcion)
VALUES (5, 'mod0005', 'activo', 'gestion de usuarios');
insert INTO modulo(
codigomod, nombre, estado, descripcion)
VALUES (6, 'mod0006', 'activo', 'gestion de preguntas');
insert INTO modulo(
codigomod, nombre, estado, descripcion)
VALUES (7, 'mod0007', 'activo', 'gestion de roles');
insert INTO permisomodulo(
idpermisomod, codigomod, idpermiso)
VALUES (1, 1, 1);
insert INTO permisomodulo(
idpermisomod, codigomod, idpermiso)
VALUES (2, 2, 1);
insert INTO permisomodulo(
idpermisomod, codigomod, idpermiso)
VALUES (3, 3, 4);
insert INTO permisomodulo(
idpermisomod, codigomod, idpermiso)
VALUES (4, 6, 4);
insert INTO permisomodulo(
idpermisomod, codigomod, idpermiso)
VALUES (5, 4, 5);
insert INTO permisomodulo(
idpermisomod, codigomod, idpermiso)
VALUES (6, 5, 6);
insert INTO permisomodulo(
idpermisomod, codigomod, idpermiso)
VALUES (7, 7, 6);
insert INTO rol(
idrol, idpermiso, nombre, descripcion, estado)
VALUES (1,1, 'estudiante', 'rol de estudiantes en preparacion', '01');
insert INTO rol(
idrol, idpermiso, nombre, descripcion, estado)
VALUES (2, 4,'docente', 'rol de docente', '02');
insert INTO rol(
idrol, idpermiso, nombre, descripcion, estado)
VALUES (3,5, 'preparador', 'docente encargado de la preparcion de un grupo para las pruebas', '03');
insert INTO rol(
idrol, idpermiso, nombre, descripcion, estado)
VALUES (4,6, 'administrador', 'administrador del sistema', '04');
insert INTO rol(
idrol, idpermiso, nombre, descripcion, estado)
VALUES (5,3, 'escritor', 'encargado de ingresar preguntas', '05');
insert INTO usuario(
iduser, numeroid, idprog, tipoid, nombres, apellidos,direccion, municipio, departamento, pais, telefono, movil,sexo, fechanacimiento, email, usuario, clave)
VALUES (1, 123451, 1, 'CC', 'camilo', 'cervantes', 'la patagonia', 'Monteria', 'Cordoba', 'Colombia', '5555555', '3555555555', 'M', '1989-01-01', 'usuario1@mail.com', 'kamilin8931', '12345');
insert INTO usuario(
iduser, numeroid, idprog, tipoid, nombres, apellidos,direccion, municipio, departamento, pais, telefono, movil, sexo, fechanacimiento, email, usuario, clave)
VALUES (2, 123452, 1, 'CC', 'luis', 'cataño', 'el inframundo', 'Monteria', 'Cordoba', 'Colombia', '5555555', '3555555555', 'M', '1989-01-01', 'usuario2@mail.com', 'luchox25', '12345');
insert INTO usuario(
iduser, numeroid, idprog, tipoid, nombres, apellidos,direccion, municipio, departamento, pais, telefono, movil, sexo, fechanacimiento, email, usuario, clave)
VALUES (3, 123453, 1, 'CC', 'anny', 'almanza', 'algun lugar del mundo', 'Monteria', 'Cordoba', 'Colombia', '5555555', '3555555555', 'F', '1989-01-01', 'usuario3@mail.com', 'aalmanza', '12345');
insert INTO usuario(
iduser, numeroid, idprog, tipoid, nombres, apellidos,direccion, municipio, departamento, pais, telefono, movil, sexo, fechanacimiento, email, usuario, clave)
VALUES (4, 123454, 1, 'CC', 'Harold', 'Bula', 'Sahagun', 'Monteria', 'Cordoba', 'Colombia', '5555555', '3555555555', 'M', '1989-01-01', 'usuario4@mail.com', 'habula', '12345');
insert INTO grupo(idadmin, idrol, descripcion, codigoregistro, estado)
VALUES (3, 1, 'Grupo creado para estudiantes en preparacion para las pruebas de estado', 'acf0123451', 'activo');
insert INTO grupo(
idadmin, idrol, descripcion, codigoregistro, estado)
VALUES (3, 4, 'Grupo para usuarios con privilegios de administrador', 'acf0123452', 'activo');
insert INTO grupo(
idadmin, idrol, descripcion, codigoregistro, estado)
VALUES (3, 2, 'Grupo para docentes', 'acf0123453', 'activo');
insert INTO grupo(
idadmin, idrol, descripcion, codigoregistro, estado)
VALUES (3, 3, 'Grupo para docentes encargados de la preparacion de los alumnos', 'acf0123454', 'activo');
insert INTO grupo(
idadmin, idrol, descripcion, codigoregistro, estado)
VALUES (3, 1, 'Grupo para prueba de control de acceso, estuadiante inactivos', 'acf0123455', 'inactivo');
insert INTO usuariogrupo(
idgrupo, iduser)
VALUES (1, 1);
insert INTO usuariogrupo(
idgrupo, iduser)
VALUES (2, 2);
insert INTO usuariogrupo(
idgrupo, iduser)
VALUES (3, 3);
insert INTO usuariogrupo(
idgrupo, iduser)
VALUES (4, 4);
|
create or replace type fg as table of varchar2(50);
declare
text varchar2(50):=&text;
c number;
d varchar2(50);
n number:=4;
r varchar2(50);
x varchar2(50);
fgf fg;
begin
fgf:=fg();
fgf.extend(50);
for i in 1..length(text) loop
d:=substr(text,i,1);
if regexp_like(text,'^[[:upper:]]+$') then
c:=mod(ascii(d)+n-65,26) + 65;
else
c:=mod(ascii(d)+n-97,26) + 97;
end if;
fgf(i):=c;
r:=chr(c);
dbms_output.put_line(r);
end loop;
end;
|
DROP TABLE modules_jobs;
DROP TABLE modules;
DROP TYPE modules_status; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.