Kaynağa Gözat

sql for database created for sprint one

Nathalia 3 yıl önce
ebeveyn
işleme
704ae46e3f
1 değiştirilmiş dosya ile 295 ekleme ve 0 silme
  1. 295
    0
      raices.sql

+ 295
- 0
raices.sql Dosyayı Görüntüle

@@ -0,0 +1,295 @@
1
+-- phpMyAdmin SQL Dump
2
+-- version 5.0.4
3
+-- https://www.phpmyadmin.net/
4
+--
5
+-- Servidor: localhost
6
+-- Tiempo de generación: 04-10-2021 a las 21:27:58
7
+-- Versión del servidor: 10.4.17-MariaDB
8
+-- Versión de PHP: 8.0.1
9
+
10
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11
+START TRANSACTION;
12
+SET time_zone = "+00:00";
13
+
14
+
15
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
16
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
17
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
18
+/*!40101 SET NAMES utf8mb4 */;
19
+
20
+--
21
+-- Base de datos: `raices`
22
+--
23
+
24
+-- --------------------------------------------------------
25
+
26
+--
27
+-- Estructura de tabla para la tabla `comerciantes`
28
+--
29
+
30
+CREATE TABLE `comerciantes` (
31
+  `id_comerciante` int(2) NOT NULL,
32
+  `nom_comerciante` varchar(100) NOT NULL,
33
+  `email` varchar(50) DEFAULT NULL,
34
+  `telefono` varchar(11) DEFAULT NULL,
35
+  `direccion` text DEFAULT NULL,
36
+  `enlaces` text DEFAULT NULL
37
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
38
+
39
+-- --------------------------------------------------------
40
+
41
+--
42
+-- Estructura de tabla para la tabla `comerciante_es`
43
+--
44
+
45
+CREATE TABLE `comerciante_es` (
46
+  `id_comerciante` int(2) NOT NULL,
47
+  `id_insignia` int(2) NOT NULL
48
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
49
+
50
+-- --------------------------------------------------------
51
+
52
+--
53
+-- Estructura de tabla para la tabla `disenos`
54
+--
55
+
56
+CREATE TABLE `disenos` (
57
+  `id_diseno` int(2) NOT NULL,
58
+  `id_producto` int(2) NOT NULL,
59
+  `diseno` varchar(50) DEFAULT NULL,
60
+  `foto` varbinary(60000) DEFAULT NULL
61
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
62
+
63
+-- --------------------------------------------------------
64
+
65
+--
66
+-- Estructura de tabla para la tabla `insignias_coms`
67
+--
68
+
69
+CREATE TABLE `insignias_coms` (
70
+  `id_insignia` int(2) NOT NULL,
71
+  `nom_insignia` varchar(50) NOT NULL,
72
+  `descripcion` text DEFAULT NULL,
73
+  `foto_insignia` varbinary(60000) NOT NULL
74
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
75
+
76
+-- --------------------------------------------------------
77
+
78
+--
79
+-- Estructura de tabla para la tabla `insignias_prods`
80
+--
81
+
82
+CREATE TABLE `insignias_prods` (
83
+  `id_insignia` int(2) NOT NULL,
84
+  `nom_insignia` varchar(50) NOT NULL,
85
+  `descripcion` text DEFAULT NULL,
86
+  `foto_insignia` varbinary(60000) NOT NULL
87
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
88
+
89
+-- --------------------------------------------------------
90
+
91
+--
92
+-- Estructura de tabla para la tabla `inventario`
93
+--
94
+
95
+CREATE TABLE `inventario` (
96
+  `id_inventario` int(2) NOT NULL,
97
+  `id_producto` int(2) NOT NULL,
98
+  `id_diseno` int(2) DEFAULT NULL,
99
+  `tamano` varchar(20) DEFAULT NULL,
100
+  `precio` decimal(10,2) DEFAULT NULL,
101
+  `cantidad` int(4) DEFAULT NULL
102
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
103
+
104
+-- --------------------------------------------------------
105
+
106
+--
107
+-- Estructura de tabla para la tabla `productos`
108
+--
109
+
110
+CREATE TABLE `productos` (
111
+  `id_producto` int(2) NOT NULL,
112
+  `nom_producto` varchar(50) NOT NULL,
113
+  `descripcion` text DEFAULT NULL,
114
+  `enlaces` text DEFAULT NULL,
115
+  `marca` varchar(50) DEFAULT NULL,
116
+  `id_default_inventario` int(2) DEFAULT NULL,
117
+  `id_default_diseno` int(2) DEFAULT NULL
118
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
119
+
120
+-- --------------------------------------------------------
121
+
122
+--
123
+-- Estructura de tabla para la tabla `producto_es`
124
+--
125
+
126
+CREATE TABLE `producto_es` (
127
+  `id_producto` int(2) NOT NULL,
128
+  `id_insignia` int(2) NOT NULL
129
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
130
+
131
+-- --------------------------------------------------------
132
+
133
+--
134
+-- Estructura de tabla para la tabla `vende`
135
+--
136
+
137
+CREATE TABLE `vende` (
138
+  `id_comerciante` int(2) NOT NULL,
139
+  `id_producto` int(2) NOT NULL
140
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
141
+
142
+--
143
+-- Índices para tablas volcadas
144
+--
145
+
146
+--
147
+-- Indices de la tabla `comerciantes`
148
+--
149
+ALTER TABLE `comerciantes`
150
+  ADD PRIMARY KEY (`id_comerciante`);
151
+
152
+--
153
+-- Indices de la tabla `comerciante_es`
154
+--
155
+ALTER TABLE `comerciante_es`
156
+  ADD PRIMARY KEY (`id_comerciante`,`id_insignia`),
157
+  ADD KEY `id_insignia` (`id_insignia`);
158
+
159
+--
160
+-- Indices de la tabla `disenos`
161
+--
162
+ALTER TABLE `disenos`
163
+  ADD PRIMARY KEY (`id_diseno`),
164
+  ADD KEY `id_producto` (`id_producto`);
165
+
166
+--
167
+-- Indices de la tabla `insignias_coms`
168
+--
169
+ALTER TABLE `insignias_coms`
170
+  ADD PRIMARY KEY (`id_insignia`);
171
+
172
+--
173
+-- Indices de la tabla `insignias_prods`
174
+--
175
+ALTER TABLE `insignias_prods`
176
+  ADD PRIMARY KEY (`id_insignia`);
177
+
178
+--
179
+-- Indices de la tabla `inventario`
180
+--
181
+ALTER TABLE `inventario`
182
+  ADD PRIMARY KEY (`id_inventario`),
183
+  ADD KEY `id_producto` (`id_producto`);
184
+
185
+--
186
+-- Indices de la tabla `productos`
187
+--
188
+ALTER TABLE `productos`
189
+  ADD PRIMARY KEY (`id_producto`),
190
+  ADD KEY `id_default_inventario` (`id_default_inventario`),
191
+  ADD KEY `id_default_diseno` (`id_default_diseno`);
192
+
193
+--
194
+-- Indices de la tabla `producto_es`
195
+--
196
+ALTER TABLE `producto_es`
197
+  ADD PRIMARY KEY (`id_producto`,`id_insignia`),
198
+  ADD KEY `id_insignia` (`id_insignia`);
199
+
200
+--
201
+-- Indices de la tabla `vende`
202
+--
203
+ALTER TABLE `vende`
204
+  ADD PRIMARY KEY (`id_comerciante`,`id_producto`),
205
+  ADD KEY `id_producto` (`id_producto`);
206
+
207
+--
208
+-- AUTO_INCREMENT de las tablas volcadas
209
+--
210
+
211
+--
212
+-- AUTO_INCREMENT de la tabla `comerciantes`
213
+--
214
+ALTER TABLE `comerciantes`
215
+  MODIFY `id_comerciante` int(2) NOT NULL AUTO_INCREMENT;
216
+
217
+--
218
+-- AUTO_INCREMENT de la tabla `disenos`
219
+--
220
+ALTER TABLE `disenos`
221
+  MODIFY `id_diseno` int(2) NOT NULL AUTO_INCREMENT;
222
+
223
+--
224
+-- AUTO_INCREMENT de la tabla `insignias_coms`
225
+--
226
+ALTER TABLE `insignias_coms`
227
+  MODIFY `id_insignia` int(2) NOT NULL AUTO_INCREMENT;
228
+
229
+--
230
+-- AUTO_INCREMENT de la tabla `insignias_prods`
231
+--
232
+ALTER TABLE `insignias_prods`
233
+  MODIFY `id_insignia` int(2) NOT NULL AUTO_INCREMENT;
234
+
235
+--
236
+-- AUTO_INCREMENT de la tabla `inventario`
237
+--
238
+ALTER TABLE `inventario`
239
+  MODIFY `id_inventario` int(2) NOT NULL AUTO_INCREMENT;
240
+
241
+--
242
+-- AUTO_INCREMENT de la tabla `productos`
243
+--
244
+ALTER TABLE `productos`
245
+  MODIFY `id_producto` int(2) NOT NULL AUTO_INCREMENT;
246
+
247
+--
248
+-- Restricciones para tablas volcadas
249
+--
250
+
251
+--
252
+-- Filtros para la tabla `comerciante_es`
253
+--
254
+ALTER TABLE `comerciante_es`
255
+  ADD CONSTRAINT `comerciante_es_ibfk_1` FOREIGN KEY (`id_comerciante`) REFERENCES `comerciantes` (`id_comerciante`),
256
+  ADD CONSTRAINT `comerciante_es_ibfk_2` FOREIGN KEY (`id_insignia`) REFERENCES `insignias_coms` (`id_insignia`);
257
+
258
+--
259
+-- Filtros para la tabla `disenos`
260
+--
261
+ALTER TABLE `disenos`
262
+  ADD CONSTRAINT `disenos_ibfk_1` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id_producto`);
263
+
264
+--
265
+-- Filtros para la tabla `inventario`
266
+--
267
+ALTER TABLE `inventario`
268
+  ADD CONSTRAINT `inventario_ibfk_1` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id_producto`);
269
+
270
+--
271
+-- Filtros para la tabla `productos`
272
+--
273
+ALTER TABLE `productos`
274
+  ADD CONSTRAINT `productos_ibfk_1` FOREIGN KEY (`id_default_inventario`) REFERENCES `inventario` (`id_inventario`) ON DELETE SET NULL,
275
+  ADD CONSTRAINT `productos_ibfk_2` FOREIGN KEY (`id_default_diseno`) REFERENCES `disenos` (`id_diseno`) ON DELETE SET NULL;
276
+
277
+--
278
+-- Filtros para la tabla `producto_es`
279
+--
280
+ALTER TABLE `producto_es`
281
+  ADD CONSTRAINT `producto_es_ibfk_1` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id_producto`),
282
+  ADD CONSTRAINT `producto_es_ibfk_2` FOREIGN KEY (`id_insignia`) REFERENCES `insignias_prods` (`id_insignia`);
283
+
284
+--
285
+-- Filtros para la tabla `vende`
286
+--
287
+ALTER TABLE `vende`
288
+  ADD CONSTRAINT `vende_ibfk_1` FOREIGN KEY (`id_comerciante`) REFERENCES `comerciantes` (`id_comerciante`),
289
+  ADD CONSTRAINT `vende_ibfk_2` FOREIGN KEY (`id_producto`) REFERENCES `productos` (`id_producto`),
290
+  ADD CONSTRAINT `vende_ibfk_3` FOREIGN KEY (`id_comerciante`) REFERENCES `comerciantes` (`id_comerciante`);
291
+COMMIT;
292
+
293
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
294
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
295
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;