Documentos de Académico
Documentos de Profesional
Documentos de Cultura
FACULTAD DE INGENIERÍA
ESCUELA PROFESIONAL DE INGENIERÍA
INDUSTRIAL
Computación en Ingeniería – T1 – Nrc 12330
INFORME II
“Tarea Grupal Práctica MySQL”
DOCENTE:
- Chimoy Asto Guillermo Enrique
INTEGRANTES:
- Blas Cueva Fabrizio Eduardo Alonso
- Loli Cassinelli Estefano Eduardo
TRUJILLO – PERÚ
2022
Trabajo
Grupal
Se le encomienda crear una base de datos que permita registrar las ventas que realiza
laempresa en la cual labora bajo las siguientes condiciones:
Se solicita:
Entregable a generar:
- Código:
--
-- Table structure for table `articulo`
--
CREATE TABLE `articulo` (
`id` int(11) NOT NULL,
`descripcion` text DEFAULT NULL,
`precio_unitario` decimal(10,2) DEFAULT NULL,
`stock` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
--
-- Dumping data for table `articulo`
--
INSERT INTO `articulo` (`id`, `descripcion`, `precio_unitario`, `stock`) VALUES
(1000, 'Nokia 1231', '500.00', 5),
(1478, 'Xiami 10 pro', '100.00', 5),
(1479, 'Motorla 10i', '150.00', 3),
(8585, 'iphone 14 pro', '320.00', 2),
(8586, 'Samsung s22+', '300.00', 1),
(8587, 'Motorola FLip', '400.00', 9);
-- --------------------------------------------------------
--
-- Table structure for table `cliente`
--
CREATE TABLE `cliente` (
`id` int(11) NOT NULL,
`nombres` varchar(100) DEFAULT NULL,
`apellido_paterno` varchar(100) DEFAULT NULL,
`apellido_materno` varchar(100) DEFAULT NULL,
`direccion` varchar(100) DEFAULT NULL,
`ciudad` varchar(100) DEFAULT NULL,
`pais` varchar(100) DEFAULT NULL,
`celular` varchar(20) DEFAULT NULL,
`fax` varchar(20) DEFAULT NULL,
`fecha_ingreso` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE
current_timestamp(),
`ind_vigente` varchar(10) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
--
-- Dumping data for table `cliente`
--
INSERT INTO `cliente` (`id`, `nombres`, `apellido_paterno`, `apellido_materno`, `direccion`,
`ciudad`, `pais`, `celular`, `fax`, `fecha_ingreso`, `ind_vigente`) VALUES
(1000, 'Remo', 'Calegari', 'Ramos', 'Las flores de huanchaco800', 'Iquitos', 'Perú', '55145',
'5454541', '2022-12-11 02:25:38', '80'),
(1478, 'Giacomo', 'Roeder', 'Sanchez', 'Colins av 4109', 'Miami', 'EEUU', '545645', '5466541',
'2022-12-11 02:11:46', '50'),
(1479, 'Juan', 'Perez', 'Aguilar', 'Las flores 363', 'Trujillo', 'Perú', '989895689', '224548', '2022-
12-11 02:03:31', '70'),
(8586, 'Maximo', 'Ride ', 'Lite', 'Miraflores ', 'Lima', 'Perú', '202020', '0210230', '2022-12-11
02:13:24', '90'),
(14799, 'Bryan', 'Yarrow', 'Zambrano', 'Mz. E559552 lt12', 'Trujillo', 'Perú', '212030',
'165615213', '2022-12-11 02:14:06', '90'),
(14800, 'Jose', 'Lopez', 'Nuñez', 'Dirección 111', 'Trujillo', 'Perú', '985748965', '248596', '2022-
12-11 02:04:06', '80');
-- --------------------------------------------------------
--
-- Table structure for table `detalle_pedido`
--
CREATE TABLE `detalle_pedido` (
`id` int(11) NOT NULL,
`id_articulo` int(11) DEFAULT NULL,
`cantidad` int(11) DEFAULT NULL,
`precio` decimal(10,2) DEFAULT NULL,
`subtotal` decimal(10,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
--
-- Dumping data for table `detalle_pedido`
--
INSERT INTO `detalle_pedido` (`id`, `id_articulo`, `cantidad`, `precio`, `subtotal`) VALUES
(1, 1000, 2, '500.00', '1000.00'),
(3, 1478, 3, '100.00', '300.00'),
(4, 8586, 1, '300.00', '300.00'),
(5, 1478, 3, '100.00', '300.00'),
(6, 8586, 1, '300.00', '300.00'),
(7, 8587, 7, '400.00', '3600.00'),
(8, 8587, 7, '400.00', '3600.00');
-- --------------------------------------------------------
--
-- Table structure for table `pedido`
--
CREATE TABLE `pedido` (
`id` int(11) NOT NULL,
`id_cliente` int(11) DEFAULT NULL,
`id_vendedor` int(11) DEFAULT NULL,
`fecha_pedido` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE
current_timestamp(),
`subtotal` decimal(10,2) DEFAULT NULL,
`impuesto` decimal(10,2) DEFAULT NULL,
`total` decimal(10,2) DEFAULT NULL,
`estado` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
--
-- Dumping data for table `pedido`
--
INSERT INTO `pedido` (`id`, `id_cliente`, `id_vendedor`, `fecha_pedido`, `subtotal`, `impuesto`,
`total`, `estado`) VALUES
(1000, 1000, 2, '2022-12-11 02:17:51', '1000.00', '18.00', '518.00', 70),
(1471, 14799, 60, '2022-12-24 02:06:02', '500.00', '18.00', '518.00', 80),
(1478, 14800, 2, '2022-12-11 02:17:54', '300.00', '18.00', '318.00', 100),
(1479, 14800, 70, '2022-12-18 02:05:23', '3600.00', '18.00', '3618.00', 100),
(8587, 8586, 40, '2022-12-15 02:06:02', '9000.00', '18.00', '9018.00', 100);
-- --------------------------------------------------------
--
-- Table structure for table `vendedor`
--
CREATE TABLE `vendedor` (
`id` int(11) NOT NULL,
`nombre` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
--
-- Dumping data for table `vendedor`
--
INSERT INTO `vendedor` (`id`, `nombre`) VALUES
(1, 'Otto'),
(2, 'Juan '),
(3, 'Pablo'),
(4, 'Jose '),
(5, 'Giacomo'),
(6, 'Jorge'),
(7, 'Carlitos'),
(8, 'Ismael'),
(9, 'Gabriel'),
(10, 'Armando');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `articulo`
--
ALTER TABLE `articulo`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `cliente`
--
ALTER TABLE `cliente`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `detalle_pedido`
--
ALTER TABLE `detalle_pedido`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_detalle_pedido_articulo` (`id_articulo`);
--
-- Indexes for table `pedido`
--
ALTER TABLE `pedido`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_pedido_cliente` (`id_cliente`);
--
-- Indexes for table `vendedor`
--
ALTER TABLE `vendedor`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `articulo`
--
ALTER TABLE `articulo`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8588;
--
-- AUTO_INCREMENT for table `cliente`
--
ALTER TABLE `cliente`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14801;
--
-- AUTO_INCREMENT for table `detalle_pedido`
--
ALTER TABLE `detalle_pedido`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `pedido`
--
ALTER TABLE `pedido`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8588;
--
-- AUTO_INCREMENT for table `vendedor`
--
ALTER TABLE `vendedor`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `detalle_pedido`
--
ALTER TABLE `detalle_pedido`
ADD CONSTRAINT `fk_detalle_pedido_articulo` FOREIGN KEY (`id_articulo`) REFERENCES
`articulo` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
--
-- Constraints for table `pedido`
--
ALTER TABLE `pedido`
ADD CONSTRAINT `fk_pedido_cliente` FOREIGN KEY (`id_cliente`) REFERENCES `cliente` (`id`)
ON DELETE NO ACTION ON UPDATE NO ACTION;
COMMIT;
- Captura de Pantalla:
c) Listar los pedidos realizados por los clientes que se registran en la ciudad de
Trujillo
d) Indicar cuantos pedidos han sido atendidos por el vendedor que tiene su nombre
que empieza con “J”
SELECT COUNT(*) FROM pedido AS p INNER JOIN vendedor AS v ON v.id =
p.id_vendedor WHERE v.nombre LIKE 'J%'
e) Actualizar el dato ciudad del cliente con ID 1000 por la ciudad de Iquitos.
UPDATE cliente SET ciudad = 'Iquitos' WHERE id = 1000