mysql>
create database taller;
Query OK, 1
row affected (0.12 sec)
mysql> use taller;
Databasechanged
mysql>createtable alumno(cveAlumnovarchar(30)
primarykey,nombrevarchar(50),aPaternovarchar(50),aMaternovarchar(50),calle
varchar(150),numero int,coloniavarchar(50),municipio varchar(50),estado
varchar(50),telefonovarchar(20),email varchar(100));
Query OK, 0
rows affected (0.23 sec)
mysql>createtable profesores(cveProfesoresvarchar(50)
primarykey,nombrevarchar(50),aPaternovarchar(50),aMaternovarchar(50),calle
varchar(150),numero int,coloniavarchar(50),municipio varchar(50),estado
varchar(50),telefonovarchar(20),especialidad varchar(150),email varchar(100));
Query OK, 0
rows affected (0.09 sec)
mysql>
create table materias(cveMateriavarchar(50) primary
key,nombrevarchar(50),semestre char);
Query OK, 0
rows affected (0.05 sec)
mysql>
create table calificaciones(cveAlumnovarchar(30) primary
key,cveMateriavarchar(50),par1 double,par2 double,par3 double,par4 double,par5
double,par6 double,par7 double,par8 double,par9
double,calificacionFinaldouble,periodovarchar(20));
Query OK, 0
rows affected (0.03 sec)
mysql>createtable carreras(cveCarreravarchar(30)
primarykey,nombrevarchar(50));
Query OK, 0
rows affected (0.07 sec)
mysql>createtable grupos(cveGrupovarchar(50)
primarykey,nombrevarchar(50),cveProfesorvarchar(50),cveAlumnovarchar(50),cveMateriavarchar(50),cveCarreravarchar(50),periodo
varchar(20));
Query OK, 0 rows affected (0.08 sec)
Procedimiento de agregar registros
mysql>delimiter //
mysql>createprocedureagregar_alumno(innoControlvarchar(30),nombre
varchar(50),aPaternovarchar(50),aMaternovarchar(50),calle varchar(150),numero
int,coloniavarchar(50),municipio varchar(50),estado
varchar(50),telefonovarchar(20),email varchar(100))
->begin
->insertinto
alumno values(noControl,nombre,aPaterno,aMaterno,calle,numero,colonia,municipio,estado,telefono,email);
->end//
Query OK, 0
rows affected (0.63 sec)
mysql>createprocedureagregar_profesor(incveProfesorvarchar(50),nombre
varchar(50),aPaternovarchar(50),aMaternovarchar(50),calle varchar(150),numero
int,coloniavarchar(50),municipio varchar(50),estado
varchar(50),telefonovarchar(20),especialidad varchar(150),email varchar(100))
->begin
->insertinto
profesores values(cveProfesor,nombre,aPaterno,aMaterno,calle,numero,colonia,municipio,estado,telefono,especialidad,email);
->end//
Query OK, 0
rows affected (0.06 sec)
mysql> create procedure
agregar_materia(incveMateriavarchar(50),nombrevarchar(50),semestre char)
-> begin
-> insert into
materiasvalues(cveMateria,nombre,semestre);
->end//
Query OK, 0
rows affected (0.27 sec)
mysql>
create procedure
agregar_calificacion(incveAlumnovarchar(30),cveMateriavarchar(50),par1
double,par2 double,par3 double,par4 double,par5 double,par6 double,par7
double,par8 double,par9 double,calificacionFinaldouble,periodovarchar(20))
->begin
->insertinto
calificaciones
values(cveAlumno,cveMateria,par1,par2,par3,par4,par5,par6,par7,par8,par9,calificacionFinal,periodo);
->end//
Query OK, 0
rows affected (0.01 sec)
mysql>createprocedureagregar_carrera(incveCarreravarchar(20),nombre
varchar(50))
->begin
->insertinto
carreras values(cveCarrera,nombre);
->end//
Query OK, 0
rows affected (1.82 sec)
mysql>createprocedureagregar_grupo(incveGrupovarchar(50),nombre
varchar(50),cveProfesorvarchar(50),cveAlumnovarchar(50),cveMateriavarchar(50),cveCarreravarchar(50),periodo
varchar(20))
->begin
->insertinto
grupos values(cveGrupo,nombre,cveProfesor,cveAlumno,cveMateria,cveCarrera,periodo);
->end//
Query OK, 0 rows affected (0.01 sec)
Procedimiento de editar registros
mysql>createprocedureeditar_alumno(innoControlvarchar(30),nombre
varchar(50),aPaternovarchar(50),aMaternovarchar(50),calle varchar(150),numero
int,coloniavarchar(50),municipio varchar(50),estado
varchar(50),telefonovarchar(20),email varchar(100))
->begin
-> update
alumno set
noControl='noControl',nombre='nombre',aPaterno='aPaterno',aMaterno='aMaterno',calle='calle',numero=numero,colonia='colonia',municipio='municipio',estado='estado',telefono='telefono',email='email';
->end//
Query OK, 0
rows affected (0.01 sec)
mysql>createprocedureeditar_profesor(incveProfesorvarchar(50),nombre
varchar(50),aPaternovarchar(50),aMaternovarchar(50),calle varchar(150),numero
int,coloniavarchar(50),municipio varchar(50),estado
varchar(50),telefonovarchar(20),especialidad varchar(150),email varchar(100))
->begin
-> update
profesores set
cveProfesor='cveProfesor',nombre='nombre',aPaterno='aPaterno',aMaterno='aMaterno',calle='calle',numero=numero,colonia='colonia',municipio='municipio',estado='estado',telefono='telefono',especialidad='especialidad',email='email';
->end//
Query OK, 0
rows affected (0.01 sec)
mysql>createprocedureeditar_materia(incveMateriavarchar(50),nombre
varchar(50),semestre char)
-> begin
->updatematerias set
cveMateria='cveMateria',nombre='nombre',semestre='semestre';
->end//
Query OK, 0
rows affected (0.04 sec)
mysql>
create procedure editar_calificacion(incveAlumnovarchar(30),cveMateriavarchar(50),par1
double,par2 double,par3 double,par4 double,par5 double,par6 double,par7 double,par8
double,par9 double,calificacionFinaldouble,periodovarchar(20))
->begin
-> update
calificaciones set cveAlumno='cveAlumno',cveMateria='cveMateria',par1='par1',par2='par2',par3='par3',par4='par4',par5='par5',par6='par6',par7='par7',par8='par8',par9='par9',calificacionFinal=calificacionFinal,periodo='periodo';
->end//
Query OK, 0
rows affected (0.02 sec)
mysql>createprocedureeditar_carrera(incveCarreravarchar(20),nombre
varchar(50))
->begin
->update
carreras set cveCarrera='cveCarrera',nombre='nombre';
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>createprocedureeditar_grupo(incveGrupovarchar(50),nombre
varchar(50),cveProfesorvarchar(50),cveAlumnovarchar(50),cveMateriavarchar(50),cveCarreravarchar(50),periodo
varchar(20))
->begin
->update grupos
set
cveGrupo='cveGrupo',nombre='nombre',cveProfesor='cveProfesor',cveAlumno='cveAlumno',cveMateria='cveMateria',cveCarrera='cveCarrera',periodo='periodo';
->end//
Query OK, 0
rows affected (0.04 sec)
Procedimiento para eliminar registros
mysql>createprocedureeliminar_alumno(innoControlvarchar(30))
->begin
->delete
from alumno where noControl='noControl';
->end//
Query OK, 0
rows affected (0.12 sec)
mysql>
create procedure eliminar_profesor(incveProfesorvarchar(50))
-> begin
->delete from profesores where
cveProfesor='cveProfesor';
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>
create procedure eliminar_materia(incveMateriavarchar(50))
-> begin
->delete from materias where
cveMateria='cveMateria';
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>createprocedureeliminar_calificacion(incveAlumnovarchar(30))
-> begin
->deletefrom
calificaciones wherecveAlumno='cveAlumno';
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>createprocedureeliminar_carrera(incveCarreravarchar(20))
->begin
->deletefrom
calificaciones wherecveCarrera='cveCarrera';
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>createprocedureeliminar_grupo(incveGrupovarchar(50))
-> begin
->deletefrom
calificaciones wherecveGrupo='cveGrupo';
->end//
Query OK, 0
rows affected (0.00 sec)
Procedimiento que visualiza los datos
mysql>createprocedurever_alumno()
-> begin
->select * from
alumno;
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>
create procedure ver_profesor()
-> begin
->select * from profesores;
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>
create procedure ver_materia()
-> begin
->select * from materias;
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>
create procedure ver_calificacion()
-> begin
->select * from calificaciones;
->end//
Query OK, 0
rows affected (0.00 sec)
mysql>
create procedure ver_carrera()
-> begin
->select * from carreras;
->end//
Query OK, 0
rows affected (0.05 sec)
mysql>
create procedure ver_grupo()
-> begin
->select * from grupos;
->end//
Query OK, 0 rows affected (0.00 sec)
mysql>call agregar_alumno('001','José Alberto','Aguirre','Gutierrez','Las
Palmas',9,'Juarez','Naucalpan','Mexico','55-31166790','alberto_aguirrez@hotmail.com');
Query OK, 1
row affected (0.00 sec)
mysql>call agregar_alumno('010','Alfredo','Aguirre','Lopez','Av.
Arroyos',145,'Flores','Atizapan','Mexico','55-14451234','alfredo_145d@hotmail.com');
Query OK, 1
row affected (0.02 sec)
mysql>call agregar_alumno('020','Horacio','Lopez','Hernandez','Col.
Providencia',157,'Tamarindos','Ecatepec','Mexico','55-80007611','horaciolop@hotmail.com');
Query OK, 1
row affected (0.00 sec)
mysql>call agregar_alumno('021','Alicia','Alvarez','Fernandez','Col.
Bugambilias',15,'America','Ecatepec','Mexico','55-67110911','ali_execut@hotmail.com');
Query OK, 1
row affected (0.00 sec)
mysql>call agregar_alumno('025','Jessica','Garcia','Hernandez','Col.
Alamos',389,'Caramelo','Atizapan','Mexico','55-76111230','jessy_love@hotmail.com');
Query OK, 1
row affected (0.00 sec)
mysql>call agregar_alumno('030','Omar','Velasco','Olivera','Col.
Reforma',76,'Romero','Polanco','Mexico','55-09874555','olivera_monk@hotmail.com');
Query OK, 1
row affected (0.00 sec)
mysql>call agregar_alumno('034','Roberto','Villalobos','Ramirez','Jardin
Balbuena',9,'Unidad JFK','Ecatepec','Mexico','55-87551233','villalobos_cft@hotmail.com');
Query OK, 1
row affected (0.00 sec)
mysql>call agregar_alumno('037','Jose Maria','Lopez','Manzur','Arcos
de Belen',90,'Dias','San Jose del
Jaral','Mexico','55-33556711','lopjose@hotmail.com');
Query OK, 1
row affected (0.00 sec)
mysql>call agregar_alumno('045','Patricio','Hernandez','Hernandez','San
Antonio',34,'Oceano','Atizapan','Mexico','55-11119075','patrick_rr@hotmail.com');
Query OK, 1
row affected (0.00 sec)
mysql> call agregar_alumno('050','Mauricio','Ramirez','Hernandez','Las
Palmas',14,'Caracol','Coacalco','Mexico','55-21009866','mau_cruzazul@hotmail.com');
Query OK, 1
row affected (0.02 sec)
mysql> call ver_alumno();
10 rows in
set (0.15 sec)
mysql> call editar_alumno('001','Ayumi Itzel','Ayala','Cervantes','Las
Palmas',19,'Juarez','Naucalpan','Mexico','55-10452298','ayumi_aiji@hotmail.com');
Query OK, 0
rows affected, 10 warnings (0.00 sec)
mysql> call
editar_alumno('002','Mauricio','Ramirez','Hernandez','Las
Palmas',14,'Caracol','Coacalco','Mexico','55-21009866','mau_cruzazul@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.01 sec)
mysql> call
editar_alumno('003','Omar','Velasco','Olivera','Col.
Reforma',76,'Romero','Polanco','Mexico','55-09874555','olivera_monk@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.00 sec)
mysql> call
editar_alumno('004','Patricio','Hernandez','Hernandez','San
Antonio',34,'Oceano','Atizapan','Mexico','55-11119075','patrick_rr@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.00 sec)
mysql> call
editar_alumno('005','Alicia','Alvarez','Fernandez','Col.
Bugambilias',15,'America','Ecatepec','Mexico','55-67110911','ali_execut@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.01 sec)
mysql> call editar_alumno('006','Jose Maria','Lopez','Manzur','Arcos
de Belen',90,'Dias','San Jose del
Jaral','Mexico','55-33556711','lopjose@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.01 sec)
mysql>
call editar_alumno('007','Jessica','Garcia','Hernandez','Col.
Alamos',389,'Caramelo','Atizapan','Mexico','55-76111230','jessy_love@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.01 sec)
mysql> call
editar_alumno('008','Roberto','Villalobos','Ramirez','Jardin
Balbuena',9,'Unidad JFK','Ecatepec','Mexico','55-87551233','villalobos_cft@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.01 sec)
mysql> call
editar_alumno('009','Alfredo','Aguirre','Lopez','Av.
Arroyos',145,'Flores','Atizapan','Mexico','55-14451234','alfredo_145d@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.00 sec)
mysql> call
editar_alumno('010','Horacio','Lopez','Hernandez','Col.
Providencia',157,'Tamarindos','Ecatepec','Mexico','55-80007611','horaciolop@hotmail.com');
Query OK,
10 rows affected, 10 warnings (0.01 sec)
mysql>
call eliminar_alumno('001');
Query OK,
10 rows affected, 10 warnings (0.06 sec)
mysql>
call eliminar_alumno('002');
Query OK, 0
rows affected (0.00 sec)
mysql>
call eliminar_alumno('003');
Query OK, 0
rows affected (0.00 sec)
mysql>
call eliminar_alumno('004');
Query OK, 0
rows affected (0.00 sec)
mysql>
call eliminar_alumno('005');
Query OK, 0
rows affected (0.00 sec)
mysql>
call eliminar_alumno('006');
Query OK, 0
rows affected (0.00 sec)
mysql>
call eliminar_alumno('007');
Query OK, 0
rows affected (0.00 sec)
mysql> call eliminar_alumno('008');
Query OK, 0
rows affected (0.00 sec)
mysql>
call eliminar_alumno('009');
Query OK, 0
rows affected (0.00 sec)
mysql>
call eliminar_alumno('010');
Query OK, 0
rows affected (0.00 sec)
No hay comentarios:
Publicar un comentario