MariaDB [matricula]> show tables; +---------------------+ | Tables_in_matricula | +---------------------+ | alumno | | alumno_materia | | materia | +---------------------+ 3 rows in set (0.001 sec) MariaDB [matricula]> describe alumno; +--------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------+----------+------+-----+---------+-------+ | carnet | char(10) | NO | PRI | NULL | | | nombre | char(40) | NO | | NULL | | | estado | char(10) | NO | | NULL | | +--------+----------+------+-----+---------+-------+ 3 rows in set (0.007 sec) MariaDB [matricula]> select * from alumno; +-----------+-----------------------+----------+ | carnet | nombre | estado | +-----------+-----------------------+----------+ | 1000 | gloria | activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +-----------+-----------------------+----------+ 5 rows in set (0.000 sec) MariaDB [matricula]> delimiter// -> ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'delimiter//' at line 1 MariaDB [matricula]> delimiter // MariaDB [matricula]> create procedure insertar_alumno(in _carnet char(10), in _nombre char(40), in _estado char(10)) -> begin -> insert into alumno values(_carnet,_nombre,_estado); -> end -> // Query OK, 0 rows affected (0.011 sec) MariaDB [matricula]> delimiter ; MariaDB [matricula]> show tables; +---------------------+ | Tables_in_matricula | +---------------------+ | alumno | | alumno_materia | | materia | +---------------------+ 3 rows in set (0.000 sec) MariaDB [matricula]> show procedure status; +-----------+-----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+ | Db | Name | Type | Definer | Modified | Created | Security_type | Comment | character_set_client | collation_connection | Database Collation | +-----------+-----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+ | matricula | insertar_alumno | PROCEDURE | root@localhost | 2022-11-01 23:53:30 | 2022-11-01 23:53:30 | DEFINER | | utf8 | utf8_general_ci | latin1_swedish_ci | +-----------+-----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+ 1 row in set (0.005 sec) MariaDB [matricula]> show create procedure insertar_alumno; +-----------------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+ | Procedure | sql_mode | Create Procedure | character_set_client | collation_connection | Database Collation | +-----------------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+ | insertar_alumno | NO_AUTO_VALUE_ON_ZERO | CREATE DEFINER=`root`@`localhost` PROCEDURE `insertar_alumno`(in _carnet char(10), in _nombre char(40), in _estado char(10)) begin insert into alumno values(_carnet,_nombre,_estado); end | utf8 | utf8_general_ci | latin1_swedish_ci | +-----------------+-----------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+--------------------+ 1 row in set (0.000 sec) MariaDB [matricula]> select * from alumno; +-----------+-----------------------+----------+ | carnet | nombre | estado | +-----------+-----------------------+----------+ | 1000 | gloria | activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +-----------+-----------------------+----------+ 5 rows in set (0.000 sec) MariaDB [matricula]> Call insertar_alumno('012','sofia','Activo'); Query OK, 1 row affected (0.002 sec) MariaDB [matricula]> select * from alumno; +-----------+-----------------------+----------+ | carnet | nombre | estado | +-----------+-----------------------+----------+ | 012 | sofia | Activo | | 1000 | gloria | activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +-----------+-----------------------+----------+ 6 rows in set (0.000 sec) MariaDB [matricula]> Call insertar_alumno('1006788000','Alexander','Activo'); Query OK, 1 row affected (0.002 sec) MariaDB [matricula]> select * from alumno; +------------+-----------------------+----------+ | carnet | nombre | estado | +------------+-----------------------+----------+ | 012 | sofia | Activo | | 1000 | gloria | activo | | 1006788000 | Alexander | Activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +------------+-----------------------+----------+ 7 rows in set (0.000 sec) MariaDB [matricula]> Delimiter // MariaDB [matricula]> Create procedure listar_alumno() -> Begin -> Select * from alumno; -> End -> // Query OK, 0 rows affected (0.002 sec) MariaDB [matricula]> Delimiter ; MariaDB [matricula]> show procedure status; +-----------+-----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+ | Db | Name | Type | Definer | Modified | Created | Security_type | Comment | character_set_client | collation_connection | Database Collation | +-----------+-----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+ | matricula | insertar_alumno | PROCEDURE | root@localhost | 2022-11-01 23:53:30 | 2022-11-01 23:53:30 | DEFINER | | utf8 | utf8_general_ci | latin1_swedish_ci | | matricula | listar_alumno | PROCEDURE | root@localhost | 2022-11-02 00:30:32 | 2022-11-02 00:30:32 | DEFINER | | utf8 | utf8_general_ci | latin1_swedish_ci | +-----------+-----------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+ 2 rows in set (0.005 sec) MariaDB [matricula]> call listar_alumno(); +------------+-----------------------+----------+ | carnet | nombre | estado | +------------+-----------------------+----------+ | 012 | sofia | Activo | | 1000 | gloria | activo | | 1006788000 | Alexander | Activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +------------+-----------------------+----------+ 7 rows in set (0.000 sec) Query OK, 0 rows affected (0.005 sec) MariaDB [matricula]> Delimiter // MariaDB [matricula]> Create procedure consultar_alumno(in carnet char(10)) -> Begin -> Select *from alumno where carnet=car; -> End -> // Query OK, 0 rows affected (0.002 sec) MariaDB [matricula]> Delimiter ; MariaDB [matricula]> call consultar_alumno(); ERROR 1318 (42000): Incorrect number of arguments for PROCEDURE matricula.consultar_alumno; expected 1, got 0 MariaDB [matricula]> call consultar_alumno('1006788000); '> ' -> ; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 MariaDB [matricula]> call consultar_alumno('1006788000'); ERROR 1054 (42S22): Unknown column 'car' in 'where clause' MariaDB [matricula]> Delimiter // MariaDB [matricula]> Create procedure consultar_alumno(in _carnet char(10)) -> Begin -> Select * from alumno where carnet=_carnet; -> End -> // ERROR 1304 (42000): PROCEDURE consultar_alumno already exists MariaDB [matricula]> Delimiter ; MariaDB [matricula]> drop procedure consultar_alumno; Query OK, 0 rows affected (0.003 sec) MariaDB [matricula]> Delimiter // MariaDB [matricula]> Create procedure consultar_alumno(in _carnet char(10)) -> Begin -> Select * from alumno where carnet=_carnet; -> End -> // Query OK, 0 rows affected (0.003 sec) MariaDB [matricula]> Delimiter ; MariaDB [matricula]> call consultar_alumno('1006788000'); +------------+-----------+--------+ | carnet | nombre | estado | +------------+-----------+--------+ | 1006788000 | Alexander | Activo | +------------+-----------+--------+ 1 row in set (0.000 sec) Query OK, 0 rows affected (0.001 sec) MariaDB [matricula]> call consultar_alumno('012'); +--------+--------+--------+ | carnet | nombre | estado | +--------+--------+--------+ | 012 | sofia | Activo | +--------+--------+--------+ 1 row in set (0.000 sec) Query OK, 0 rows affected (0.001 sec) MariaDB [matricula]> Delimiter // MariaDB [matricula]> Create procedure actualizar_alumno(in _carnet char(10), in _nombre char(40), in _estado char(10)) -> Begin -> Update alumno set nombre=_nombre, estado=_estado where carnet=_carnet; -> End -> // Query OK, 0 rows affected (0.002 sec) MariaDB [matricula]> Delimiter ; MariaDB [matricula]> call actualizar_alumno('012','Maria Antonieta DeLas Nieves','inactivo'); Query OK, 1 row affected (0.003 sec) MariaDB [matricula]> select * from alumno; +------------+------------------------------+----------+ | carnet | nombre | estado | +------------+------------------------------+----------+ | 012 | Maria Antonieta DeLas Nieves | inactivo | | 1000 | gloria | activo | | 1006788000 | Alexander | Activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +------------+------------------------------+----------+ 7 rows in set (0.000 sec) MariaDB [matricula]> Delimiter // MariaDB [matricula]> Create procedure eliminar_alumno(in _carnet char(10)) -> Begin -> Delete from alumno where carnet=_carnet; -> End -> // Query OK, 0 rows affected (0.002 sec) MariaDB [matricula]> Delimiter ; MariaDB [matricula]> select * from alumno; +------------+------------------------------+----------+ | carnet | nombre | estado | +------------+------------------------------+----------+ | 012 | Maria Antonieta DeLas Nieves | inactivo | | 1000 | gloria | activo | | 1006788000 | Alexander | Activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +------------+------------------------------+----------+ 7 rows in set (0.000 sec) MariaDB [matricula]> call eliminar_alumno('012'); Query OK, 1 row affected (0.002 sec) MariaDB [matricula]> select * from alumno; +------------+-----------------------+----------+ | carnet | nombre | estado | +------------+-----------------------+----------+ | 1000 | gloria | activo | | 1006788000 | Alexander | Activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +------------+-----------------------+----------+ 6 rows in set (0.000 sec) MariaDB [matricula]> call listar_alumno(); +------------+-----------------------+----------+ | carnet | nombre | estado | +------------+-----------------------+----------+ | 1000 | gloria | activo | | 1006788000 | Alexander | Activo | | 112121545 | kelly ruiz | inactivo | | 2000 | jose miguel jaramillo | activo | | 3000 | luna | activo | | dsfds | sdfsdf | Activo | +------------+-----------------------+----------+ 6 rows in set (0.000 sec) Query OK, 0 rows affected (0.011 sec)