Last active
July 16, 2018 06:17
-
-
Save luanbitar/b2e83cbea6fb673dc19761c0f2afb8eb to your computer and use it in GitHub Desktop.
Exercício de banco de dados 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #2a | |
| # Buscar nome, CPF, e-mail, data de inscrição, tipo de inscrição (descrição) e código de inscrição dos cinco primeiros participantes inscritos; | |
| SELECT p.nome, p.cpf, p.email, | |
| i.data AS data_inscricao, i.codigo AS codigo_inscricao | |
| FROM participante AS p | |
| INNER JOIN participante_inscricao AS i | |
| ON p.id = i.participante_id | |
| ORDER BY i.data ASC | |
| LIMIT 5; | |
| #2b | |
| #Listar todos os dados dos minicursos, os nomes e e-mail dos instrutores e os descritivos dos seus status, tipos e turnos; | |
| SELECT m.titulo, m.descricao, m.data_cadastro, m.total_vagas, m.ativo, | |
| p.nome AS nome_instrutor, p.email AS email_instrutor, | |
| mstatus.nome AS nome_status, mstatus.descricao AS descricao_status, | |
| mtipo.nome AS nome_tipo, mtipo.descricao AS descricao_tipo, | |
| mturno.nome AS nome_turno, mturno.descricao AS descricao_turno | |
| FROM minicurso AS m | |
| INNER JOIN participante AS p | |
| ON m.instrutor_id = p.id | |
| INNER JOIN minicurso_status AS mstatus | |
| ON m.minicurso_status_id = mstatus.id | |
| INNER JOIN minicurso_tipo AS mtipo | |
| ON m.minicurso_tipo_id = mtipo.id | |
| INNER JOIN minicurso_turno AS mturno | |
| ON m.minicurso_turno_id = mturno.id ; | |
| #2c | |
| # Listar todos os participantes que se inscreveram no evento ENCOSIS entre os dias 01 e 20/05; | |
| SELECT p.nome, e.nome AS evento , pi.data AS data_inscricao | |
| FROM participante AS p | |
| INNER JOIN participante_inscricao AS pi | |
| ON p.id = pi.participante_id | |
| INNER JOIN tipo_inscricao AS ti | |
| ON pi.tipo_inscricao_id = ti.id | |
| INNER JOIN evento AS e | |
| ON ti.evento_id = e.id | |
| WHERE e.nome = 'ENCOSIS' | |
| AND pi.data BETWEEN '2017-05-01 00:00:00' AND '2017-05-20 23:59:59'; | |
| #2d | |
| #Buscar o valor total de inscrições para o ENCOSIS (a base deve possuir pelo menos 15 registros, distribuídos aleatoriamente); | |
| SELECT CONCAT('R$', CAST(SUM(t.valor) AS CHAR(20))) AS valor_total_inscricoes_ENCOSIS | |
| FROM participante_inscricao AS i | |
| INNER JOIN tipo_inscricao as t | |
| ON i.tipo_inscricao_id = t.id | |
| INNER JOIN evento AS e | |
| ON t.evento_id = e.id | |
| WHERE e.nome = 'ENCOSIS'; | |
| #2e | |
| # Buscar o valor total de inscrições para o COMPUTANDO (a base deve possuir pelo menos 30 registros, distribuídos aleatoriamente); | |
| SELECT CONCAT('R$', CAST(SUM(t.valor) AS CHAR(20))) AS valor_total_inscricoes_COMPUTANDO | |
| FROM participante_inscricao AS i | |
| INNER JOIN tipo_inscricao as t | |
| ON i.tipo_inscricao_id = t.id | |
| INNER JOIN evento AS e | |
| ON t.evento_id = e.id | |
| WHERE e.nome = 'COMPUTANDO'; | |
| #2f | |
| # Os nomes de todos os minicursos oferecidos somente no ENCOSIS, e seus instrutores; | |
| SELECT m.titulo as minicurso, p.nome as instrutor | |
| FROM participante AS p | |
| INNER JOIN participante_inscricao AS pi | |
| ON p.id = pi.participante_id | |
| INNER JOIN tipo_inscricao AS ti | |
| ON pi.tipo_inscricao_id = ti.id | |
| INNER JOIN evento AS e | |
| ON ti.evento_id = e.id | |
| INNER JOIN minicurso AS m | |
| ON p.id = m.instrutor_id | |
| WHERE e.nome = 'ENCOSIS'; | |
| #2g | |
| # O número total de participantes inscritos, em cada evento; | |
| SELECT e.nome AS evento, COUNT(p.nome) AS quantidade_inscritos | |
| FROM participante AS p | |
| INNER JOIN participante_inscricao AS pi | |
| ON p.id = pi.participante_id | |
| INNER JOIN tipo_inscricao AS ti | |
| ON pi.tipo_inscricao_id = ti.id | |
| INNER JOIN evento AS e | |
| ON ti.evento_id = e.id | |
| GROUP BY e.nome; | |
| #2h | |
| # O número total de participantes inscritos para cada tipo de inscrição; | |
| SELECT ti.titulo as tipo_inscricao, COUNT(p.nome) AS quantidade_participante | |
| FROM participante AS p | |
| INNER JOIN participante_inscricao AS pi | |
| ON p.id = pi.participante_id | |
| INNER JOIN tipo_inscricao AS ti | |
| ON pi.tipo_inscricao_id = ti.id | |
| GROUP BY ti.titulo; | |
| #2i | |
| # O número total de participantes inscritos, em cada minicurso; | |
| SELECT m.titulo AS minicurso, COUNT(p.nome) AS quantidade_inscritos | |
| FROM participante AS p | |
| INNER JOIN minicurso_inscricao AS mi | |
| ON p.id = mi.participante_id | |
| INNER JOIN minicurso AS m | |
| ON mi.minicurso_id = m.id | |
| GROUP BY m.titulo; | |
| #2j | |
| # Os nomes de todos os participantes que foram ao ENCOSIS e não foram COMPUTANDO; | |
| SELECT p.nome, e.nome AS evento | |
| FROM participante AS p | |
| INNER JOIN participante_inscricao AS pi | |
| ON p.id = pi.participante_id | |
| INNER JOIN tipo_inscricao AS ti | |
| ON pi.tipo_inscricao_id = ti.id | |
| INNER JOIN evento AS e | |
| ON ti.evento_id = e.id | |
| WHERE e.nome = 'ENCOSIS' | |
| AND NOT e.nome = 'COMPUTANDO'; | |
| #2k | |
| # Todos os minicursos nos quais o participante José Benevides está inscrito; | |
| SELECT m.titulo AS minicurso | |
| FROM participante AS p | |
| INNER JOIN minicurso_inscricao AS mi | |
| ON p.id = mi.participante_id | |
| INNER JOIN minicurso AS m | |
| ON mi.minicurso_id = m.id | |
| WHERE p.nome = 'José Benevides'; | |
| #2l | |
| # Todos os participantes que estão inscritos no evento ENCOSIS mas não se inscreveram para participar de nenhum minicurso; | |
| SELECT p.nome, e.nome AS evento | |
| FROM participante AS p | |
| INNER JOIN participante_inscricao AS pi | |
| ON p.id = pi.participante_id | |
| INNER JOIN tipo_inscricao AS ti | |
| ON pi.tipo_inscricao_id = ti.id | |
| INNER JOIN evento AS e | |
| ON ti.evento_id = e.id | |
| WHERE e.nome = 'ENCOSIS' | |
| AND NOT p.id = ANY(SELECT mi.participante_id FROM minicurso_inscricao AS mi WHERE p.id = mi.participante_id); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| SQLyog Community v12.4.1 (64 bit) | |
| MySQL - 5.7.14 : Database - dbeventos | |
| ********************************************************************* | |
| */ | |
| /*!40101 SET NAMES utf8 */; | |
| /*!40101 SET SQL_MODE=''*/; | |
| /*!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 */; | |
| CREATE DATABASE /*!32312 IF NOT EXISTS*/`dbeventos` /*!40100 DEFAULT CHARACTER SET utf8 */; | |
| USE `dbeventos`; | |
| /*Table structure for table `evento` */ | |
| DROP TABLE IF EXISTS `evento`; | |
| CREATE TABLE `evento` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `nome` varchar(150) NOT NULL, | |
| `descricao` text NOT NULL, | |
| `inicio` datetime NOT NULL, | |
| `fim` datetime NOT NULL, | |
| `ano` smallint(4) NOT NULL, | |
| `ativo` tinyint(4) NOT NULL DEFAULT '1', | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; | |
| /*Data for the table `evento` */ | |
| insert into `evento`(`id`,`nome`,`descricao`,`inicio`,`fim`,`ano`,`ativo`) values | |
| (1,'ENCOSIS','Encontro Regional de Computação e Sistemas de Informação','2016-06-02 08:00:00','2016-06-04 17:00:00',2016,1), | |
| (2,'COMPUTANDO','Competições Integradas de Computação','2016-10-03 18:00:00','2016-10-07 22:00:00',2016,1); | |
| /*Table structure for table `inscricao_status` */ | |
| DROP TABLE IF EXISTS `inscricao_status`; | |
| CREATE TABLE `inscricao_status` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `nome` varchar(45) NOT NULL, | |
| `descricao` varchar(500) NOT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; | |
| /*Data for the table `inscricao_status` */ | |
| insert into `inscricao_status`(`id`,`nome`,`descricao`) values | |
| (1,'Registrada','Registrada'), | |
| (2,'Aguardando Pagamento','Aguardando Pagamento'), | |
| (3,'Pagamento Confirmado','Pagamento Confirmado'), | |
| (4,'Cancelada','Cancelada'); | |
| /*Table structure for table `minicurso` */ | |
| DROP TABLE IF EXISTS `minicurso`; | |
| CREATE TABLE `minicurso` ( | |
| `id` int(10) unsigned NOT NULL, | |
| `titulo` varchar(150) NOT NULL, | |
| `descricao` text NOT NULL, | |
| `data_cadastro` datetime NOT NULL, | |
| `total_vagas` int(11) NOT NULL, | |
| `ativo` tinyint(4) NOT NULL DEFAULT '1', | |
| `instrutor_id` int(11) NOT NULL, | |
| `minicurso_status_id` int(11) NOT NULL, | |
| `minicurso_tipo_id` int(11) NOT NULL, | |
| `minicurso_turno_id` int(11) NOT NULL, | |
| PRIMARY KEY (`id`), | |
| KEY `fk_minicurso_participante1_idx` (`instrutor_id`), | |
| KEY `fk_minicurso_minicurso_status1_idx` (`minicurso_status_id`), | |
| KEY `fk_minicurso_minicurso_tipo1_idx` (`minicurso_tipo_id`), | |
| KEY `fk_minicurso_minicurso_turno1_idx` (`minicurso_turno_id`), | |
| CONSTRAINT `fk_minicurso_minicurso_status1` FOREIGN KEY (`minicurso_status_id`) REFERENCES `minicurso_status` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, | |
| CONSTRAINT `fk_minicurso_minicurso_tipo1` FOREIGN KEY (`minicurso_tipo_id`) REFERENCES `minicurso_tipo` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, | |
| CONSTRAINT `fk_minicurso_minicurso_turno1` FOREIGN KEY (`minicurso_turno_id`) REFERENCES `minicurso_turno` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, | |
| CONSTRAINT `fk_minicurso_participante1` FOREIGN KEY (`instrutor_id`) REFERENCES `participante` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | |
| /*Data for the table `minicurso` */ | |
| insert into `minicurso`(`id`,`titulo`,`descricao`,`data_cadastro`,`total_vagas`,`ativo`,`instrutor_id`,`minicurso_status_id`,`minicurso_tipo_id`,`minicurso_turno_id`) values | |
| (1,'Python','Python\r\n','2017-05-10 17:43:49',5,1,16,1,1,1), | |
| (2,'PHP','PHP\r\n','2017-05-10 17:44:19',5,1,3,1,1,2), | |
| (3,'Aprenda a ficar rico programando','Aprenda a ficar rico programando','2017-05-10 17:44:47',5,1,5,1,3,2), | |
| (4,'Computação na nuvem','Computação na nuvem','2017-05-10 17:45:21',5,1,3,1,1,1), | |
| (5,'Informática Básica','Informática Básica, para a comunidade em geral.','2017-05-10 17:45:59',5,1,7,1,2,3), | |
| (6,'Android','Android','2017-05-10 17:46:40',5,1,4,1,1,3), | |
| (7,'Javascript e outras coisas chibatas','Javascript e outras coisas chibatas','2017-05-10 17:47:23',5,1,16,1,1,3); | |
| /*Table structure for table `minicurso_inscricao` */ | |
| DROP TABLE IF EXISTS `minicurso_inscricao`; | |
| CREATE TABLE `minicurso_inscricao` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `data` datetime NOT NULL, | |
| `presenca_confirmada` tinyint(4) NOT NULL DEFAULT '0', | |
| `participante_id` int(11) NOT NULL, | |
| `minicurso_id` int(10) unsigned NOT NULL, | |
| PRIMARY KEY (`id`), | |
| KEY `fk_minicurso_inscricao_participante1_idx` (`participante_id`), | |
| KEY `fk_minicurso_inscricao_minicurso1_idx` (`minicurso_id`), | |
| CONSTRAINT `fk_minicurso_inscricao_minicurso1` FOREIGN KEY (`minicurso_id`) REFERENCES `minicurso` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, | |
| CONSTRAINT `fk_minicurso_inscricao_participante1` FOREIGN KEY (`participante_id`) REFERENCES `participante` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION | |
| ) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; | |
| /*Data for the table `minicurso_inscricao` */ | |
| insert into `minicurso_inscricao`(`id`,`data`,`presenca_confirmada`,`participante_id`,`minicurso_id`) values | |
| (1,'2017-05-10 18:00:44',0,1,1), | |
| (2,'2017-05-10 18:00:53',0,1,2), | |
| (3,'2017-05-10 18:01:00',0,1,3), | |
| (4,'2017-05-17 18:01:08',0,2,1), | |
| (5,'2017-05-11 18:01:15',0,2,2), | |
| (6,'2017-05-10 18:01:26',0,2,3), | |
| (7,'2017-05-10 18:01:33',0,2,4), | |
| (8,'2017-05-10 18:01:42',0,3,5), | |
| (9,'2017-05-10 18:01:48',0,4,6), | |
| (10,'2017-05-11 18:01:55',0,4,7), | |
| (11,'2017-05-10 18:02:00',0,5,7), | |
| (12,'2017-05-10 18:02:09',0,6,7), | |
| (13,'2017-05-10 18:02:14',0,7,7), | |
| (14,'2017-05-10 18:02:25',0,8,1), | |
| (16,'2017-05-10 18:02:28',0,9,6), | |
| (17,'2017-05-10 18:02:39',0,9,5), | |
| (18,'2017-05-10 18:02:44',0,15,5), | |
| (19,'2017-05-10 18:02:51',0,15,6), | |
| (20,'2017-05-10 18:02:59',0,13,5); | |
| /*Table structure for table `minicurso_status` */ | |
| DROP TABLE IF EXISTS `minicurso_status`; | |
| CREATE TABLE `minicurso_status` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `nome` varchar(45) NOT NULL, | |
| `descricao` varchar(500) DEFAULT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; | |
| /*Data for the table `minicurso_status` */ | |
| insert into `minicurso_status`(`id`,`nome`,`descricao`) values | |
| (1,'Ativo','Ativo'), | |
| (2,'Cancelado','Cancelado'), | |
| (3,'Inscrições Encerradas','Inscrições Encerradas'), | |
| (4,'Aguardando Confirmação','Aguardando Confirmação'); | |
| /*Table structure for table `minicurso_tipo` */ | |
| DROP TABLE IF EXISTS `minicurso_tipo`; | |
| CREATE TABLE `minicurso_tipo` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `nome` varchar(45) NOT NULL, | |
| `descricao` varchar(500) DEFAULT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; | |
| /*Data for the table `minicurso_tipo` */ | |
| insert into `minicurso_tipo`(`id`,`nome`,`descricao`) values | |
| (1,'Convencional','Convencional'), | |
| (2,'Especial ','Minicurso oferecido em horário especial ou carga horária diferenciada'), | |
| (3,'Gratuito','Minicursos Gratuitos'); | |
| /*Table structure for table `minicurso_turno` */ | |
| DROP TABLE IF EXISTS `minicurso_turno`; | |
| CREATE TABLE `minicurso_turno` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `nome` varchar(45) NOT NULL DEFAULT 'Manhã, Tarde, Noite', | |
| `descricao` varchar(500) NOT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; | |
| /*Data for the table `minicurso_turno` */ | |
| insert into `minicurso_turno`(`id`,`nome`,`descricao`) values | |
| (1,'Manhã','8h às 12h'), | |
| (2,'Tarde','14h às 17h'), | |
| (3,'Noite','18h às 22h'); | |
| /*Table structure for table `participante` */ | |
| DROP TABLE IF EXISTS `participante`; | |
| CREATE TABLE `participante` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `nome` varchar(150) NOT NULL, | |
| `email` varchar(150) NOT NULL, | |
| `cpf` varchar(14) NOT NULL, | |
| `ativo` tinyint(4) NOT NULL DEFAULT '1', | |
| `cidade` varchar(150) NOT NULL, | |
| `uf` char(2) NOT NULL, | |
| `sexo` char(1) NOT NULL, | |
| `telefone` varchar(45) NOT NULL, | |
| `data_cadastro` datetime NOT NULL, | |
| `instituicao_representada` varchar(150) NOT NULL, | |
| `mini_cv` text, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; | |
| /*Data for the table `participante` */ | |
| insert into `participante`(`id`,`nome`,`email`,`cpf`,`ativo`,`cidade`,`uf`,`sexo`,`telefone`,`data_cadastro`,`instituicao_representada`,`mini_cv`) values | |
| (1,'José Benevides','[email protected]','332.757.345-04',1,'Manaus','AM','M','99999999999','2016-01-04 17:25:19','FUCAPI',NULL), | |
| (2,'Mailson Correia','[email protected]','573.523.787-07',1,'Manaus','AM','M','99999999999','2016-01-04 17:25:19','FUCAPI',NULL), | |
| (3,'Alexandre Amoreira','[email protected]','117.258.524-54',1,'Acre','AC','M','99999999999','2017-05-03 17:28:07','AGILE MASTERS',NULL), | |
| (4,'Senhor Pedroca','[email protected]','511.616.972-33',1,'Ceará','CE','M','99999999999','2017-05-10 17:29:08','GRUPO PEDROCA',NULL), | |
| (5,'Arlindo Souza','[email protected]','284.876.814-25',1,'Manaus','AM','M','99999999999','2017-05-25 17:31:17','FUCAPI',NULL), | |
| (6,'Pedro de Lara','[email protected]','513.131.668-55',1,'Manaus','AM','M','99999999999','2017-05-10 17:31:43','FACE BOOKS',NULL), | |
| (7,'Capee Rotto','[email protected]','791.393.739-40',1,'Porto Velho','RO','M','99999999999','2016-01-04 17:25:19','HELLBOYS',NULL), | |
| (8,'Carlos Drumond','[email protected]','235.307.832-00',1,'Manaus','AM','M','99999999999','2017-05-10 17:33:29','TI TECH',NULL), | |
| (9,'Alberto Roberto','[email protected]','588.017.872-27',1,'Manaus','AM','M','99999999999','2017-05-10 17:34:14','TI TECH',NULL), | |
| (10,'Juliana Samba','[email protected]','971.653.131-17',1,'Manaus','AM','F','99999999999','2017-05-10 17:34:40','TI TECH',NULL), | |
| (11,'Amaro Barroso','[email protected]','313.363.442-96',1,'Manuas','AM','M','99999999999','2016-01-04 17:25:19','TI TECH',NULL), | |
| (12,'Larissa Costa','[email protected]','684.025.728-20',1,'Manausa','AM','F','88888888888','2017-02-10 17:35:51','LARIKA TOTAL',NULL), | |
| (13,'Albertina Moraes','[email protected]','529.545.669-22',1,'Manaus','AM','F','99999999999','2017-05-10 17:36:25','LARIKA TOTAL',NULL), | |
| (14,'Cláudia Costa','[email protected]','418.573.010-13',1,'Manaus','AM','F','99999999999','2016-01-04 17:25:19','FACE BOOKS',NULL), | |
| (15,'Alexandra Karian','[email protected]','114.974.221-67',1,'Manaus','AM','F','99999999999','2017-05-10 17:37:26','FACE BOOKS',NULL), | |
| (16,'Pablo Castro','[email protected]','000.000.000-00',1,'Cuba','NA','M','99999999999','2017-04-10 17:39:18','LOS CABRAS BUENOS',NULL); | |
| /*Table structure for table `participante_inscricao` */ | |
| DROP TABLE IF EXISTS `participante_inscricao`; | |
| CREATE TABLE `participante_inscricao` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `codigo` varchar(45) NOT NULL, | |
| `data` datetime NOT NULL, | |
| `atualizacao` datetime DEFAULT NULL, | |
| `observacoes` text, | |
| `cortesia` tinyint(4) NOT NULL DEFAULT '0', | |
| `presenca_confirmada` tinyint(4) NOT NULL DEFAULT '0', | |
| `inscricao_status_id` int(11) NOT NULL, | |
| `tipo_inscricao_id` int(11) NOT NULL, | |
| `participante_id` int(11) NOT NULL, | |
| PRIMARY KEY (`id`), | |
| KEY `fk_participante_inscricao_inscricao_status1_idx` (`inscricao_status_id`), | |
| KEY `fk_participante_inscricao_tipo_inscricao1_idx` (`tipo_inscricao_id`), | |
| KEY `fk_participante_inscricao_participante1_idx` (`participante_id`), | |
| CONSTRAINT `fk_participante_inscricao_inscricao_status1` FOREIGN KEY (`inscricao_status_id`) REFERENCES `inscricao_status` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, | |
| CONSTRAINT `fk_participante_inscricao_participante1` FOREIGN KEY (`participante_id`) REFERENCES `participante` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, | |
| CONSTRAINT `fk_participante_inscricao_tipo_inscricao1` FOREIGN KEY (`tipo_inscricao_id`) REFERENCES `tipo_inscricao` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION | |
| ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8; | |
| /*Data for the table `participante_inscricao` */ | |
| insert into `participante_inscricao`(`id`,`codigo`,`data`,`atualizacao`,`observacoes`,`cortesia`,`presenca_confirmada`,`inscricao_status_id`,`tipo_inscricao_id`,`participante_id`) values | |
| (1,'1','2017-05-10 17:52:51',NULL,NULL,0,0,1,1,1), | |
| (2,'2','2017-04-03 17:53:16',NULL,NULL,0,0,2,1,2), | |
| (3,'3','2017-05-17 17:53:44',NULL,NULL,0,0,3,2,3), | |
| (4,'4','2017-03-07 17:54:09',NULL,NULL,0,0,3,2,4), | |
| (5,'5','2017-05-10 17:54:38',NULL,NULL,0,0,3,2,5), | |
| (6,'6','2017-05-10 17:54:38',NULL,NULL,0,0,3,2,6), | |
| (7,'7','2017-05-10 17:54:38',NULL,NULL,0,0,1,1,7), | |
| (8,'8','2017-05-10 17:54:38',NULL,NULL,0,0,3,5,8), | |
| (10,'9','2017-05-10 17:54:38',NULL,NULL,0,0,2,6,9), | |
| (11,'10','2017-05-10 17:54:38',NULL,NULL,0,0,3,6,10), | |
| (12,'11','2017-05-10 17:54:38',NULL,NULL,0,0,1,4,11), | |
| (13,'12','2017-05-10 17:54:38',NULL,NULL,0,0,3,4,12), | |
| (14,'13','2017-05-10 17:54:38',NULL,NULL,0,0,1,2,13), | |
| (15,'14','2017-05-10 17:54:38',NULL,NULL,0,0,3,2,14), | |
| (16,'15','2017-05-10 17:54:38',NULL,NULL,0,0,3,2,15), | |
| (17,'16','2017-05-10 17:54:38',NULL,NULL,0,0,3,2,16), | |
| (20,'17','2017-05-10 17:54:38',NULL,NULL,0,0,3,6,2), | |
| (21,'18','2017-05-10 17:54:38',NULL,NULL,0,0,3,4,4); | |
| /*Table structure for table `tipo_inscricao` */ | |
| DROP TABLE IF EXISTS `tipo_inscricao`; | |
| CREATE TABLE `tipo_inscricao` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `titulo` varchar(100) NOT NULL, | |
| `descricao` text NOT NULL, | |
| `valor` float NOT NULL, | |
| `ativo` tinyint(4) NOT NULL DEFAULT '1', | |
| `evento_id` int(11) NOT NULL, | |
| PRIMARY KEY (`id`), | |
| KEY `fk_tipo_inscricao_evento_idx` (`evento_id`), | |
| CONSTRAINT `fk_tipo_inscricao_evento` FOREIGN KEY (`evento_id`) REFERENCES `evento` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION | |
| ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; | |
| /*Data for the table `tipo_inscricao` */ | |
| insert into `tipo_inscricao`(`id`,`titulo`,`descricao`,`valor`,`ativo`,`evento_id`) values | |
| (1,'Estudante ','Estudante ',25,1,1), | |
| (2,'Profissional','Profissional',50,1,1), | |
| (3,'Associados','Associados',50,1,2), | |
| (4,'Estudantes','Estudantes',25,1,2), | |
| (5,'Pesquisadores','Pesquisadores',70,1,2), | |
| (6,'Imprensa','Imprensa',10,1,2); | |
| /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | |
| /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | |
| /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | |
| /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment