· 8 years ago · Feb 22, 2018, 08:02 PM
1-- Table structure for table `juego`
2--
3
4DROP TABLE IF EXISTS `juego`;
5/*!40101 SET @saved_cs_client = @@character_set_client */;
6/*!40101 SET character_set_client = utf8 */;
7CREATE TABLE `juego` (
8 `idjuegos` int(10) unsigned NOT NULL AUTO_INCREMENT,
9 `nombre` varchar(100) NOT NULL,
10 `tipo` enum('FPS','Adventure','RPG','Strategy','Fighting','Sports') NOT NULL,
11 `multijugador` enum('S','N') DEFAULT 'N',
12 PRIMARY KEY (`idjuegos`),
13 UNIQUE KEY `nombre_UNIQUE` (`nombre`)
14) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
15/*!40101 SET character_set_client = @saved_cs_client */;
16
17--
18-- Dumping data for table `juego`
19--
20
21LOCK TABLES `juego` WRITE;
22/*!40000 ALTER TABLE `juego` DISABLE KEYS */;
23INSERT INTO `juego` VALUES (1,'Rise of the Tomb Raider','Adventure','N'),(2,'Quantum Brealk','FPS','N'),(3,'Infamous: Second Son','FPS','N');
24/*!40000 ALTER TABLE `juego` ENABLE KEYS */;
25UNLOCK TABLES;
26
27--
28-- Table structure for table `misjuegos`
29--
30
31DROP TABLE IF EXISTS `misjuegos`;
32/*!40101 SET @saved_cs_client = @@character_set_client */;
33/*!40101 SET character_set_client = utf8 */;
34CREATE TABLE `misjuegos` (
35 `id_usuario` varchar(45) NOT NULL,
36 `id_juego` int(10) unsigned NOT NULL,
37 `id_plataforma` enum('PC','PS3','PS4','PSVITA','XBOX360','XOBOXO','SWITCH','N3DS') NOT NULL,
38 `precio` decimal(5,2) DEFAULT NULL,
39 PRIMARY KEY (`id_usuario`,`id_plataforma`,`id_juego`),
40 KEY `fk_juego_idx` (`id_juego`),
41 CONSTRAINT `fk_juego` FOREIGN KEY (`id_juego`) REFERENCES `juego` (`idjuegos`) ON DELETE CASCADE ON UPDATE CASCADE,
42 CONSTRAINT `fk_usuario` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`id_usuario`) ON DELETE CASCADE ON UPDATE CASCADE
43) ENGINE=InnoDB DEFAULT CHARSET=utf8;
44/*!40101 SET character_set_client = @saved_cs_client */;
45
46--
47-- Dumping data for table `misjuegos`
48--
49
50LOCK TABLES `misjuegos` WRITE;
51/*!40000 ALTER TABLE `misjuegos` DISABLE KEYS */;
52INSERT INTO `misjuegos` VALUES ('p01',2,'PC',NULL),('p01',3,'PC',NULL),('p01',1,'PS4',NULL);
53/*!40000 ALTER TABLE `misjuegos` ENABLE KEYS */;
54UNLOCK TABLES;
55
56--
57-- Table structure for table `usuario`
58--
59
60DROP TABLE IF EXISTS `usuario`;
61/*!40101 SET @saved_cs_client = @@character_set_client */;
62/*!40101 SET character_set_client = utf8 */;
63CREATE TABLE `usuario` (
64 `id_usuario` varchar(45) NOT NULL,
65 `nombre` varchar(25) NOT NULL,
66 `ape1` varchar(45) NOT NULL,
67 `ape2` varchar(45) NOT NULL,
68 `email` varchar(255) NOT NULL,
69 `nacimiento` date NOT NULL,
70 PRIMARY KEY (`id_usuario`)
71) ENGINE=InnoDB DEFAULT CHARSET=utf8;
72/*!40101 SET character_set_client = @saved_cs_client */;
73
74--
75-- Dumping data for table `usuario`
76--
77
78LOCK TABLES `usuario` WRITE;
79/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
80INSERT INTO `usuario` VALUES ('p01','Amparo','Ortega','Jun','aoj@ieslasfuentezuelas.com','1988-01-07');
81/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;
82UNLOCK TABLES;
83/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
84
85/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
86/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
87/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
88/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
89/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
90/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
91/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;