-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvideogames.sql
119 lines (95 loc) · 3.25 KB
/
videogames.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 03-08-2021 a las 22:03:57
-- Versión del servidor: 10.4.19-MariaDB
-- Versión de PHP: 7.3.28
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: `videogames`
--
DELIMITER $$
--
-- Procedimientos
--
CREATE DEFINER=`root`@`localhost` PROCEDURE `deleteTemporalGame` (IN `idgame` INT) begin
update game set status = 0 where idGame = idgame;
end$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `findall` () BEGIN
select *from game as g inner join category as c on g.Category_idCategory = c.idCategory;
end$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `modifyGame` (IN `idgame` INT, IN `namegame` VARCHAR(120), IN `imggame` LONGBLOB, IN `datepremiere` DATE, IN `category` INT) begin
update game set nameGame = namegame, img_game = imggame, date_premiere = datepremiere, Category_idCategory = category where idGame = idgame;
end$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `registerGame` (IN `namegame` VARCHAR(120), IN `imggame` LONGBLOB, IN `datepremiere` DATE, IN `category` INT) begin
insert into game(nameGame,img_game,date_premiere,Category_idCategory) values(namegame,imggame,datepremiere,category);
end$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `category`
--
CREATE TABLE `category` (
`idCategory` int(11) NOT NULL,
`nameCategory` varchar(120) COLLATE utf32_spanish_ci NOT NULL,
`status` tinyint(4) DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf32 COLLATE=utf32_spanish_ci;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `game`
--
CREATE TABLE `game` (
`idGame` int(11) NOT NULL,
`nameGame` varchar(120) COLLATE utf32_spanish_ci NOT NULL,
`img_game` longblob NOT NULL,
`Category_idCategory` int(11) NOT NULL,
`date_premiere` date NOT NULL,
`status` tinyint(4) NOT NULL DEFAULT 1
) ENGINE=InnoDB DEFAULT CHARSET=utf32 COLLATE=utf32_spanish_ci;
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `category`
--
ALTER TABLE `category`
ADD PRIMARY KEY (`idCategory`);
--
-- Indices de la tabla `game`
--
ALTER TABLE `game`
ADD PRIMARY KEY (`idGame`),
ADD KEY `fk_game_Category_idCategory` (`Category_idCategory`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `category`
--
ALTER TABLE `category`
MODIFY `idCategory` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de la tabla `game`
--
ALTER TABLE `game`
MODIFY `idGame` int(11) NOT NULL AUTO_INCREMENT;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `game`
--
ALTER TABLE `game`
ADD CONSTRAINT `fk_game_Category_idCategory` FOREIGN KEY (`Category_idCategory`) REFERENCES `category` (`idCategory`);
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 */;