0% found this document useful (0 votes)
8 views8 pages

scriptSQL

The document contains SQL commands for creating a database named 'cafe_sena' and its associated tables, including 'compras', 'consumidores', 'eventos', 'facturas', 'facturas_prod', 'insumos', 'productos', 'proveedores', 'usuarios', and 'utensilios'. Each table is defined with its respective columns, data types, primary keys, and foreign key constraints. Additionally, it includes data insertion commands for some tables, primarily for 'eventos', 'insumos', 'productos', and 'usuarios'.

Uploaded by

Mikael Gaviria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views8 pages

scriptSQL

The document contains SQL commands for creating a database named 'cafe_sena' and its associated tables, including 'compras', 'consumidores', 'eventos', 'facturas', 'facturas_prod', 'insumos', 'productos', 'proveedores', 'usuarios', and 'utensilios'. Each table is defined with its respective columns, data types, primary keys, and foreign key constraints. Additionally, it includes data insertion commands for some tables, primarily for 'eventos', 'insumos', 'productos', and 'usuarios'.

Uploaded by

Mikael Gaviria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CREATE DATABASE cafe_sena;

USE cafe_sena;

DROP TABLE IF EXISTS `compras`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `compras` (
`productos_codigo` int NOT NULL,
`productos_facturas_nro` int NOT NULL,
`productos_facturas_consumidores_cedula` int NOT NULL,
`proveedores_nit` bigint NOT NULL,
PRIMARY KEY
(`productos_codigo`,`productos_facturas_nro`,`productos_facturas_consumidores_
cedula`,`proveedores_nit`),
KEY `fk_productos_has_proveedores_proveedores1_idx` (`proveedores_nit`),
KEY `fk_productos_has_proveedores_productos1_idx`
(`productos_codigo`,`productos_facturas_nro`,`productos_facturas_consumidores_
cedula`),
CONSTRAINT `compras_ibfk_1` FOREIGN KEY (`productos_codigo`) REFERENCES
`productos` (`codigo`) ON UPDATE CASCADE,
CONSTRAINT `compras_ibfk_2` FOREIGN KEY (`proveedores_nit`) REFERENCES
`proveedores` (`nit`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `compras`
--

LOCK TABLES `compras` WRITE;


/*!40000 ALTER TABLE `compras` DISABLE KEYS */;
/*!40000 ALTER TABLE `compras` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `consumidores`
--

DROP TABLE IF EXISTS `consumidores`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `consumidores` (
`cedula` bigint NOT NULL,
`nombre` varchar(45) NOT NULL,
`apellido` varchar(45) NOT NULL,
`telefono` varchar(25) NOT NULL,
PRIMARY KEY (`cedula`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `consumidores`
--

LOCK TABLES `consumidores` WRITE;


/*!40000 ALTER TABLE `consumidores` DISABLE KEYS */;
/*!40000 ALTER TABLE `consumidores` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `eventos`
--

DROP TABLE IF EXISTS `eventos`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `eventos` (
`codigo` int NOT NULL AUTO_INCREMENT,
`titulo` varchar(155) NOT NULL,
`fecha` date NOT NULL,
`hora_inicio` char(8) NOT NULL,
`hora_fin` char(8) NOT NULL,
`imagen` varchar(500) NOT NULL,
`descripcion` varchar(500) NOT NULL,
`cupo` int NOT NULL,
PRIMARY KEY (`codigo`)
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `eventos`
--

LOCK TABLES `eventos` WRITE;


/*!40000 ALTER TABLE `eventos` DISABLE KEYS */;
INSERT INTO `eventos` VALUES (68,'Gala de beneficiencia','2024-05-16','8:00
am','2:00
pm','https://th.bing.com/th/id/OIP.0VK5LUMnLYF9Z31EhrBC_wHaE8?rs=1&pid=ImgDetM
ain','Imagina una noche llena de glamour y sofisticación en un salón de baile
iluminado por candelabros. Este evento de gala de beneficencia presenta una
cena de cuatro platos preparada por chefs de renombre.',35),(69,'Evento de
Campo: Festival de Música al Aire Libre','2024-05-20','1:00 pm','8:00
pm','https://th.bing.com/th/id/R.b9fc227377537f21146f8ee4f14d96b4?rik=u2OBpm6G
DZ8qTA&pid=ImgRaw&r=0','Imagina un día lleno de música, sol y diversión en un
hermoso campo verde. Este festival de música al aire libre presenta a bandas
locales e internacionales en tres escenarios diferentes. ',25);
/*!40000 ALTER TABLE `eventos` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `facturas`
--

DROP TABLE IF EXISTS `facturas`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `facturas` (
`nro` int NOT NULL AUTO_INCREMENT,
`fecha` date NOT NULL,
`estado` tinyint NOT NULL,
`total` int NOT NULL,
`consumidor` bigint DEFAULT NULL,
PRIMARY KEY (`nro`),
KEY `fk_facturas_consumidores` (`consumidor`),
CONSTRAINT `fk_facturas_consumidores` FOREIGN KEY (`consumidor`) REFERENCES
`consumidores` (`cedula`)
) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `facturas`
--

LOCK TABLES `facturas` WRITE;


/*!40000 ALTER TABLE `facturas` DISABLE KEYS */;
/*!40000 ALTER TABLE `facturas` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `facturas_prod`
--

DROP TABLE IF EXISTS `facturas_prod`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `facturas_prod` (
`id` int NOT NULL AUTO_INCREMENT,
`id_producto` int NOT NULL,
`id_factura` int NOT NULL,
`precio_u` int NOT NULL,
`cantidad` int NOT NULL,
PRIMARY KEY (`id`),
KEY `tbl_facturas_prod_fk_id_producto` (`id_producto`),
KEY `tbl_facturas_prod_fk_id_factura` (`id_factura`),
CONSTRAINT `tbl_facturas_prod_fk_id_factura` FOREIGN KEY (`id_factura`)
REFERENCES `facturas` (`nro`),
CONSTRAINT `tbl_facturas_prod_fk_id_producto` FOREIGN KEY (`id_producto`)
REFERENCES `productos` (`codigo`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_general_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `facturas_prod`
--

LOCK TABLES `facturas_prod` WRITE;


/*!40000 ALTER TABLE `facturas_prod` DISABLE KEYS */;
/*!40000 ALTER TABLE `facturas_prod` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `insumos`
--

DROP TABLE IF EXISTS `insumos`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `insumos` (
`codigo` int NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) NOT NULL,
`cantidad` int NOT NULL,
`imagen` varchar(500) NOT NULL,
`f_ingreso` date NOT NULL,
`f_vencimiento` date NOT NULL,
`costo` int NOT NULL,
PRIMARY KEY (`codigo`)
) ENGINE=InnoDB AUTO_INCREMENT=123147 DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `insumos`
--
LOCK TABLES `insumos` WRITE;
/*!40000 ALTER TABLE `insumos` DISABLE KEYS */;
INSERT INTO `insumos` VALUES (123133,'Queso',3,'https://tropicalcheese.com/wp-
content/uploads/2020/06/peruvian-cheese-12oz-820x820.jpg','2024-04-04','2024-
04-09',3500),(123144,'Harina de trigo',6,'https://th.bing.com/th/id/OIP.RCDoF-
MEDhllMfjJmw88ygHaHa?rs=1&pid=ImgDetMain','2024-05-13','2024-05-
15',9000),(123146,'Leche
deslactosada',5,'https://th.bing.com/th/id/R.de7126892dec66c16efee9bbebf9f826?
rik=MYpfvGY26VM3Mw&riu=https%3a%2f%2ffanyv88.com%3a443%2fhttp%2fwww.beiplas.com%2fwp-
content%2fuploads%2f2012%2f03%2fbolsa-para-
leche.jpg&ehk=jTlKluDEHXDRnzBA2RRCu1KeWJGcTadTZtXVcTL9Pkg%3d&risl=&pid=ImgRaw&
r=0&sres=1&sresct=1','2024-05-14','2024-05-18',3500);
/*!40000 ALTER TABLE `insumos` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `productos`
--

DROP TABLE IF EXISTS `productos`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `productos` (
`codigo` int NOT NULL AUTO_INCREMENT,
`imagen` varchar(500) NOT NULL,
`nombre` varchar(45) NOT NULL,
`descripcion` varchar(500) NOT NULL,
`precio` int NOT NULL,
`tipo` varchar(55) NOT NULL,
PRIMARY KEY (`codigo`)
) ENGINE=InnoDB AUTO_INCREMENT=76 DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `productos`
--

LOCK TABLES `productos` WRITE;


/*!40000 ALTER TABLE `productos` DISABLE KEYS */;
INSERT INTO `productos` VALUES
(68,'https://th.bing.com/th/id/OIP.Ci1ylRGyN534C7P7IqfNkQHaE8?rs=1&pid=ImgDetM
ain','Café Arábica','Es considerado uno de los mejores cafés del mundo.
Proviene de la especie Coffea arabica y se cultiva principalmente en países
como Colombia, Brasil y
Etiopía.',3500,'cafes'),(69,'https://th.bing.com/th/id/R.fa0c4f27b0cf36a4d22d1
311665047de?rik=png%2ftuqKWmbOYg&riu=https%3a%2f%2ffanyv88.com%3a443%2fhttp%2fimagenes.4ever.eu%2fdata%2fd
ownload%2fcomida-y-bebida%2ftaza-de-cafe%2c-granos-de-cafe-
219182.jpg&ehk=qyrm462bCx9kB%2b5WCi35qH3w6SDUnJXUvtEsuH75%2frA%3d&risl=&pid=Im
gRaw&r=0','Café Robusta','Es una especie de café más resistente y robusta.
Proviene de la especie Coffea canephora y se cultiva principalmente en países
como Vietnam, Brasil y
Uganda.',4000,'cafes'),(70,'https://borealtelevision.com/wp-
content/uploads/2022/05/taza-de-cafe-1024x768.jpg','Café de Origen Único','Se
refiere a aquellos cafés que provienen de una única región o finca. Estos
cafés suelen tener características particulares que los distinguen, como
suelo, clima y
altitud.',4500,'cafes'),(71,'https://th.bing.com/th/id/OIP.cwNGPEUk4d_swgqzqGl
pfgHaFI?w=750&h=520&rs=1&pid=ImgDetMain','Café de Especialidad','Es aquel que
ha sido evaluado y calificado por expertos catadores. Este tipo de café se
cultiva en condiciones ideales, se recolecta a mano y se procesa con cuidado
para resaltar sus sabores y
aromas.',3500,'cafes'),(72,'https://cocktails.mixology.eu/wp-
content/uploads/sites/5/2019/03/mixology_cocktail-klassiker-dry-
martini.jpg','Martini','Es un cóctel clásico que se sirve en una copa de
cóctel y se hace con ginebra y vermut seco. A menudo se adorna con una
aceituna o un giro de
limón.',9500,'cocteleria'),(73,'https://th.bing.com/th/id/OIP.QQrAGxOkaM1bjluq
wzprlgHaE_?rs=1&pid=ImgDetMain','Mojito','Es un cóctel refrescante de origen
cubano que se hace con ron blanco, azúcar (o jarabe de azúcar), jugo de lima,
soda y menta. Se sirve en un vaso alto con mucho hielo y se adorna con una
ramita de
menta.',11000,'cocteleria'),(74,'https://th.bing.com/th/id/R.273af4f1b013443c7
730003b8a980a95?rik=%2fK13oyu7aMdt4g&pid=ImgRaw&r=0','Croissant','Es un
panecillo de origen francés, hecho con una pasta de hojaldre que le da una
textura crujiente y ligera. Se suele comer para el desayuno o la merienda, y
puede ser dulce o salado.',4000,'panaderia'),(75,'https://4.bp.blogspot.com/-
KyzdB9RobS4/W9Up1A8CNjI/AAAAAAAAFKY/I030t2fOB5w1ShXpmktaYsmQPzUo-
dFcQCLcBGAs/s1600/dsc05442.jpg','Pastel de Zanahoria','El pastel de zanahoria
es un clásico que nunca pasa de moda. Se elabora con zanahorias ralladas, que
le dan una textura húmeda y un sabor dulce y terroso.',5500,'panaderia');
/*!40000 ALTER TABLE `productos` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `proveedores`
--

DROP TABLE IF EXISTS `proveedores`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `proveedores` (
`nit` bigint NOT NULL,
`nombre` varchar(45) NOT NULL,
`apellido` varchar(45) NOT NULL,
`direccion` varchar(45) NOT NULL,
`telefono` varchar(16) DEFAULT NULL,
PRIMARY KEY (`nit`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `proveedores`
--

LOCK TABLES `proveedores` WRITE;


/*!40000 ALTER TABLE `proveedores` DISABLE KEYS */;
/*!40000 ALTER TABLE `proveedores` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `usuarios`
--

DROP TABLE IF EXISTS `usuarios`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `usuarios` (
`cedula` bigint NOT NULL,
`nombre` varchar(45) NOT NULL,
`apellido` varchar(45) NOT NULL,
`correo` varchar(45) NOT NULL,
PRIMARY KEY (`cedula`),
UNIQUE KEY `correo` (`correo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `usuarios`
--

LOCK TABLES `usuarios` WRITE;


/*!40000 ALTER TABLE `usuarios` DISABLE KEYS */;
INSERT INTO `usuarios` VALUES
(1023467888,'Mikael','Gaviria','[email protected]');
/*!40000 ALTER TABLE `usuarios` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `utensilios`
--

DROP TABLE IF EXISTS `utensilios`;


/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `utensilios` (
`codigo` int NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) NOT NULL,
`cantidad` int NOT NULL,
`imagen` varchar(500) NOT NULL,
PRIMARY KEY (`codigo`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb3;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `utensilios`
--

LOCK TABLES `utensilios` WRITE;


/*!40000 ALTER TABLE `utensilios` DISABLE KEYS */;
INSERT INTO `utensilios` VALUES (11,'Vaso
ancho',6,'https://th.bing.com/th/id/R.2519c32ef927130efb4d1433073fb835?rik=qBJ
OeamefhUVgg&pid=ImgRaw&r=0'),(22,'Cuchillo
grande',4,'https://th.bing.com/th/id/OIP.K-
ov3eVBTl3YBnWLsIlqFwHaHa?rs=1&pid=ImgDetMain'),(23,'Cuchara',10,'https://th.bi
ng.com/th/id/OIP.9vVN_-ON2TamTSXpr-
tYoQHaHa?rs=1&pid=ImgDetMain'),(25,'Tenedor',7,'https://th.bing.com/th/id/OIP.
9mdsllVD1NWE3R36RNe8uQHaHa?rs=1&pid=ImgDetMain');
/*!40000 ALTER TABLE `utensilios` 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 2024-05-14 7:02:57

You might also like