Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Presentado por
Hector Fabiany Villanueva Olcunche
Ejercicios:
Curso
Tipo Automotores
Incidentes
create procedure insincidentes (codigo int(11),fecha_ini date, placa
varchar(6), lugar varchar(40), heridos int(11), fallecidos int(11),
autos_involucrados int(11))
insert into incidentes (incicodigo, incifecha, inciplaca, incilugar,
incicantheridos, incicanfatalidades, incicanautosinvolucrados)
values(codigo, fecha_ini, placa, lugar, heridos, fallecidos,
autos_involucrados);
Muestre todos los campos de la tabla curso en orden ascendente según el valor.
create procedure ordencurso ()
select IdCodcurs, nomcur, horascur, valorcur from curso
order by valorcur;
call ordencurso ();
Mostrar los pedidos con los respectivos artículos (código, nombre, valor y cantidad
pedida).
create procedure orden ()
select articulo.idart, articulo.titart, articuloxpedido.canart_artped,
articuloxpedido.valven_artped
from articulo
INNER JOIN articuloxpedido
ON articulo.idart = articuloxpedido.idart
Visualizar los datos de las empresas fundadas entre el año 1991 y 1998.
create procedure fundacion ()
select * from compañia
where comañofun <= 1998 and comañofun >= 1991;
Visualizar los incidentes del vehículo con placas " FLL420", este reporte debe visualizar la
fecha, el lugar, la cantidad de heridos del incidente, la fecha de inicio la de expiración de la
póliza y el valor asegurado.
create procedure incidentes_FLL420()
select inciplaca, incifecha, incilugar, incicantheridos, asefechainicio, asefechaexpiracion,
asevalorasegurado
from incidentes, aseguramientos
where inciplaca = 'FLL420';
3 Realice las Siguientes funciones en MySQL:
Cuente el número de estudiantes cuya edad sea mayor a 22.
select count(edadest)
from estudiante
where edadest > 22;
Calcule el valor promedio de los cursos cuyas horas sean mayores a 40.
select avg(valorcur)
from curso
where horascur > 40;
--
-- Table structure for table `articulo`
--
--
-- Dumping data for table `articulo`
--
--
-- Table structure for table `articuloxpedido`
--
--
-- Dumping data for table `articuloxpedido`
--
--
-- Table structure for table `aseguramientos`
--
--
-- Dumping data for table `aseguramientos`
--
--
-- Table structure for table `auditoria_profesor`
--
--
-- Table structure for table `automotores`
--
--
-- Dumping data for table `automotores`
--
--
-- Table structure for table `cliente`
--
--
-- Dumping data for table `cliente`
--
--
-- Table structure for table `compañia`
--
--
-- Dumping data for table `compañia`
--
--
-- Table structure for table `curso`
--
--
-- Dumping data for table `curso`
--
--
-- Table structure for table `estudiante`
--
--
-- Dumping data for table `estudiante`
--
--
-- Table structure for table `estudiantexcurso`
--
--
-- Dumping data for table `estudiantexcurso`
--
--
-- Dumping data for table `incidentes`
--
--
-- Table structure for table `pedido`
--
--
-- Dumping data for table `pedido`
--
--
-- Table structure for table `profesor`
--
--
-- Dumping data for table `profesor`
--
--
-- Table structure for table `tiposautomotores`
--
DROP TABLE IF EXISTS `tiposautomotores`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
SET character_set_client = utf8mb4 ;
CREATE TABLE `tiposautomotores` (
`auttipo` int(11) NOT NULL,
`autnombre` varchar(30) DEFAULT NULL,
PRIMARY KEY (`auttipo`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tiposautomotores`
--
--
-- Dumping events for database 'laboratoriosql'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;