{"id":955,"date":"2016-06-10T23:36:43","date_gmt":"2016-06-10T23:36:43","guid":{"rendered":"http:\/\/hardsoftsecurity.es\/?p=955"},"modified":"2016-06-10T23:36:43","modified_gmt":"2016-06-10T23:36:43","slug":"bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones","status":"publish","type":"post","link":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/","title":{"rendered":"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones."},"content":{"rendered":"<p>Hola buenas hoy os traigo un peque\u00f1o ejercicio de bases de datos relacionales, el cual os voy a ense\u00f1ar el resultado del c\u00f3digo programado.<\/p>\n<p><img data-recalc-dims=\"1\" fetchpriority=\"high\" decoding=\"async\" data-attachment-id=\"956\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/mysql-logo-1329320869\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&amp;ssl=1\" data-orig-size=\"800,413\" data-comments-opened=\"1\" data-image-title=\"mysql-logo-1329320869\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&amp;ssl=1\" class=\"size-full wp-image-956 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?resize=800%2C413&#038;ssl=1\" alt=\"mysql-logo-1329320869\" width=\"800\" height=\"413\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?w=800&amp;ssl=1 800w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?resize=300%2C155&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?resize=768%2C396&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?resize=750%2C387&amp;ssl=1 750w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><!--more--><\/p>\n<p>Comenzamos con el c\u00f3digo, la primera parte que mostrare ser\u00e1 el dise\u00f1o f\u00edsico de la base de datos:<\/p>\n<p>\/**********************************************************************************************************************************************************************\/<\/p>\n<p>\/*********************************************** \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 F\u00cdSICO \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0*********************************************************************\/<br \/>\nDROP TABLE IF EXISTS DDM_TUTORES;<br \/>\nCREATE TABLE IF NOT EXISTS DDM_TUTORES(<br \/>\nid INT PRIMARY KEY,<br \/>\nNombreResponsable VARCHAR(255) NOT NULL,<br \/>\nParentesco VARCHAR(50) NOT NULL,<br \/>\nTelefonoResponsable CHAR(9) NOT NULL<br \/>\n)ENGINE=INNODB CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI;<\/p>\n<p>DESCRIBE DDM_TUTORES;<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"957\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_1-10\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_1.png?fit=832%2C166&amp;ssl=1\" data-orig-size=\"832,166\" data-comments-opened=\"1\" data-image-title=\"Screenshot_1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_1.png?fit=800%2C160&amp;ssl=1\" class=\"size-full wp-image-957 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_1.png?resize=800%2C160&#038;ssl=1\" alt=\"Screenshot_1\" width=\"800\" height=\"160\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_1.png?w=832&amp;ssl=1 832w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_1.png?resize=300%2C60&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_1.png?resize=768%2C153&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_1.png?resize=750%2C150&amp;ssl=1 750w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>DROP TABLE IF EXISTS DDM_ALUMNOS;<br \/>\nCREATE TABLE IF NOT EXISTS DDM_ALUMNOS(<br \/>\nid INT PRIMARY KEY,<br \/>\nNombreAlumno VARCHAR(250) NOT NULL,<br \/>\nFechaNacimiento DATE NOT NULL,<br \/>\ntutor INT NOT NULL,<br \/>\nnumexpedientes INT NOT NULL DEFAULT 0,<br \/>\nCONSTRAINT FK1ALUMNOSTUTORES FOREIGN KEY(tutor) REFERENCES DDM_TUTORES(id) ON UPDATE CASCADE ON DELETE NO ACTION<br \/>\n)ENGINE=INNODB CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI;<\/p>\n<p>DESCRIBE DDM_ALUMNOS;<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" data-attachment-id=\"958\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_2-11\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_2.png?fit=790%2C162&amp;ssl=1\" data-orig-size=\"790,162\" data-comments-opened=\"1\" data-image-title=\"Screenshot_2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_2.png?fit=790%2C162&amp;ssl=1\" class=\"size-full wp-image-958 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_2.png?resize=790%2C162&#038;ssl=1\" alt=\"Screenshot_2\" width=\"790\" height=\"162\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_2.png?w=790&amp;ssl=1 790w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_2.png?resize=300%2C62&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_2.png?resize=768%2C157&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_2.png?resize=750%2C154&amp;ssl=1 750w\" sizes=\"(max-width: 790px) 100vw, 790px\" \/><\/p>\n<p>DROP TABLE IF EXISTS DDM_EXPEDIENTES;<br \/>\nCREATE TABLE IF NOT EXISTS DDM_EXPEDIENTES(<br \/>\nid INT PRIMARY KEY,<br \/>\nalumno INT NOT NULL,<br \/>\nFechaExpediente DATE NOT NULL,<br \/>\nMotivoExpediente VARCHAR(250) NOT NULL,<br \/>\nCONSTRAINT FK2EXPEDIENTES FOREIGN KEY(alumno) REFERENCES DDM_ALUMNOS(id) ON UPDATE CASCADE ON DELETE NO ACTION<br \/>\n)ENGINE=INNODB CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI;<\/p>\n<p>DESCRIBE DDM_EXPEDIENTES;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"959\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_3-10\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_3.png?fit=803%2C147&amp;ssl=1\" data-orig-size=\"803,147\" data-comments-opened=\"1\" data-image-title=\"Screenshot_3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_3.png?fit=800%2C146&amp;ssl=1\" class=\"size-full wp-image-959 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_3.png?resize=800%2C146&#038;ssl=1\" alt=\"Screenshot_3\" width=\"800\" height=\"146\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_3.png?w=803&amp;ssl=1 803w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_3.png?resize=300%2C55&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_3.png?resize=768%2C141&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_3.png?resize=750%2C137&amp;ssl=1 750w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>DROP TABLE IF EXISTS DDM_TOTALES;<br \/>\nCREATE TABLE IF NOT EXISTS DDM_TOTALES(<br \/>\nid INT PRIMARY KEY,<br \/>\ntotalumnos INT NOT NULL DEFAULT 0,<br \/>\ntotexpedientes INT NOT NULL DEFAULT 0,<br \/>\ntottutores INT NOT NULL DEFAULT 0<br \/>\n)ENGINE=INNODB CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI;<\/p>\n<p>DESCRIBE DDM_TOTALES;<\/p>\n<p>INSERT INTO DDM_TOTALES(id) VALUES<br \/>\n(1);<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"960\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_4-9\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_4.png?fit=717%2C148&amp;ssl=1\" data-orig-size=\"717,148\" data-comments-opened=\"1\" data-image-title=\"Screenshot_4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_4.png?fit=717%2C148&amp;ssl=1\" class=\"size-full wp-image-960 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_4.png?resize=717%2C148&#038;ssl=1\" alt=\"Screenshot_4\" width=\"717\" height=\"148\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_4.png?w=717&amp;ssl=1 717w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_4.png?resize=300%2C62&amp;ssl=1 300w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><\/p>\n<p>\/**********************************************************************************************************************************************************************\/<\/p>\n<p>\/*********************************************** \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 TRIGGERS \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0****************************************************************\/<\/p>\n<p>DROP TRIGGER IF EXISTS CUENTAEXPEDIENTES;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE TRIGGER CUENTAEXPEDIENTES AFTER INSERT ON DDM_EXPEDIENTES<br \/>\nFOR EACH ROW<br \/>\nBEGIN<br \/>\nUPDATE DDM_ALUMNOS<br \/>\nSET numexpedientes = numexpedientes + 1<br \/>\nWHERE DDM_ALUMNOS.id = NEW.alumno;<\/p>\n<p>UPDATE DDM_TOTALES<br \/>\nSET totexpedientes = totexpedientes + 1<br \/>\nWHERE DDM_TOTALES.id = 1;<\/p>\n<p>END \/\/<\/p>\n<p>DELIMITER ;<\/p>\n<p>\/* ***********************************************************************************************\/<br \/>\nDROP TRIGGER IF EXISTS CUENTATUTORES;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE TRIGGER CUENTATUTORES AFTER INSERT ON DDM_TUTORES<br \/>\nFOR EACH ROW<br \/>\nBEGIN<br \/>\nUPDATE DDM_TOTALES<br \/>\nSET tottutores = tottutores + 1<br \/>\nWHERE DDM_TOTALES.id = 1;<\/p>\n<p>END \/\/<\/p>\n<p>DELIMITER ;<br \/>\n\/* ***********************************************************************************************\/<br \/>\nDROP TRIGGER IF EXISTS CUENTAALUMNOS;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE TRIGGER CUENTAALUMNOS AFTER INSERT ON DDM_ALUMNOS<br \/>\nFOR EACH ROW<br \/>\nBEGIN<br \/>\nUPDATE DDM_TOTALES<br \/>\nSET totalumnos = totalumnos + 1<br \/>\nWHERE DDM_TOTALES.id = 1;<\/p>\n<p>END \/\/<\/p>\n<p>DELIMITER ;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"961\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_5-9\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?fit=1879%2C365&amp;ssl=1\" data-orig-size=\"1879,365\" data-comments-opened=\"1\" data-image-title=\"Screenshot_5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?fit=800%2C155&amp;ssl=1\" class=\"size-full wp-image-961 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?resize=800%2C155&#038;ssl=1\" alt=\"Screenshot_5\" width=\"800\" height=\"155\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?w=1879&amp;ssl=1 1879w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?resize=300%2C58&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?resize=768%2C149&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?resize=1024%2C199&amp;ssl=1 1024w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?resize=750%2C146&amp;ssl=1 750w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_5.png?w=1600&amp;ssl=1 1600w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\/**********************************************************************************************************************************************************************\/<\/p>\n<p>\/*********************************************** \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 INSERTS \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0****************************************************************\/<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(1,&#8217;Alberto Grau L\u00f3pez&#8217;,&#8217;Padre&#8217;,&#8217;600600600&#8242;);<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(2,&#8217;Ana M\u00e9ndez Sanz&#8217;,&#8217;Madre&#8217;,&#8217;612612612&#8242;);<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(3,&#8217;Luc\u00eda \u00c1lvarez Rilo&#8217;,&#8217;Madre&#8217;,&#8217;699699699&#8242;);<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(4,&#8217;Antonio Abad P\u00e9rez&#8217;,&#8217;Padre&#8217;,&#8217;634634634&#8242;);<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(5,&#8217;Elena P\u00e9rez P\u00e9rez&#8217;,&#8217;Madre&#8217;,&#8217;600700800&#8242;);<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(6,&#8217;Alicia V\u00e1zquez Egea&#8217;,&#8217;Madre&#8217;,&#8217;654654654&#8242;);<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(7,&#8217;Alberto L\u00f3pez Gala&#8217;,&#8217;Tutor Legal&#8217;,&#8217;678678678&#8242;);<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(8,&#8217;Jos\u00e9 Mateo Soto&#8217;,&#8217;Padre&#8217;,&#8217;677677677&#8242;);<br \/>\nINSERT INTO DDM_TUTORES(id, NombreResponsable, Parentesco, TelefonoResponsable) VALUES<br \/>\n(9,&#8217;Rosa Aledo Mu\u00f1oz&#8217;,&#8217;Madre&#8217;,&#8217;611611611&#8242;);<br \/>\nSELECT * FROM DDM_TUTORES;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"962\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_6-10\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_6.png?fit=517%2C169&amp;ssl=1\" data-orig-size=\"517,169\" data-comments-opened=\"1\" data-image-title=\"Screenshot_6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_6.png?fit=517%2C169&amp;ssl=1\" class=\"size-full wp-image-962 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_6.png?resize=517%2C169&#038;ssl=1\" alt=\"Screenshot_6\" width=\"517\" height=\"169\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_6.png?w=517&amp;ssl=1 517w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_6.png?resize=300%2C98&amp;ssl=1 300w\" sizes=\"(max-width: 517px) 100vw, 517px\" \/><br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(1,&#8217;Alba Grau P\u00e9rez&#8217;,&#8217;1998-02-05&#8242;,&#8217;1&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(2,&#8217;Pablo Gea Sanz&#8217;,&#8217;1997-03-19&#8242;,&#8217;2&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(3,&#8217;Rafael Gil Rilo&#8217;,&#8217;1997-04-01&#8242;,&#8217;3&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(4,&#8217;Ana Abad Lara&#8217;,&#8217;1998-01-03&#8242;,&#8217;4&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(5,&#8217;Eva Abad Lara&#8217;,&#8217;1999-07-20&#8242;,&#8217;4&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(6,&#8217;Carla Rojo Sala&#8217;,&#8217;2000-05-05&#8242;,&#8217;5&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(7,&#8217;Jos\u00e9 Pardo Olmo&#8217;,&#8217;2000-10-19&#8242;,&#8217;6&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(8,&#8217;Beatriz Vera Cobos&#8217;,&#8217;1999-12-12&#8242;,&#8217;7&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(9,&#8217;Pablo Mateo Lara&#8217;,&#8217;2000-08-14&#8242;,&#8217;8&#8242;);<br \/>\nINSERT INTO DDM_ALUMNOS(id, NombreAlumno, FechaNacimiento, tutor) VALUES<br \/>\n(10,&#8217;Carlos Pino Sabina&#8217;,&#8217;1999-06-06&#8242;,&#8217;9&#8242;);<\/p>\n<p>SELECT * FROM DDM_ALUMNOS;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"963\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_7-8\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_7.png?fit=564%2C181&amp;ssl=1\" data-orig-size=\"564,181\" data-comments-opened=\"1\" data-image-title=\"Screenshot_7\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_7.png?fit=564%2C181&amp;ssl=1\" class=\"size-full wp-image-963 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_7.png?resize=564%2C181&#038;ssl=1\" alt=\"Screenshot_7\" width=\"564\" height=\"181\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_7.png?w=564&amp;ssl=1 564w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_7.png?resize=300%2C96&amp;ssl=1 300w\" sizes=\"(max-width: 564px) 100vw, 564px\" \/><br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(1,&#8217;1&#8242;,&#8217;2013-10-14&#8242;,&#8217;Agresi\u00f3n verbal a un compa\u00f1ero&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(2,&#8217;2&#8242;,&#8217;2014-01-27&#8242;,&#8217;Agresi\u00f3n f\u00edsica a un compa\u00f1ero&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(3,&#8217;3&#8242;,&#8217;2014-02-20&#8242;,&#8217;Hurto de material del centro&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(4,&#8217;4&#8242;,&#8217;2014-02-26&#8242;,&#8217;agresi\u00f3n verbal a un compa\u00f1ero&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(5,&#8217;5&#8242;,&#8217;2014-03-02&#8242;,&#8217;Rotura del mobiliario de clase&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(6,&#8217;6&#8242;,&#8217;2014-05-03&#8242;,&#8217;Agresi\u00f3n verbal a un compa\u00f1ero&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(7,&#8217;1&#8242;,&#8217;2015-01-23&#8242;,&#8217;Agresi\u00f3n verbal a un compa\u00f1ero&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(8,&#8217;7&#8242;,&#8217;2015-02-03&#8242;,&#8217;Rotura del mobiliario de clase&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(9,&#8217;8&#8242;,&#8217;2015-02-17&#8242;,&#8217;Agresi\u00f3n f\u00edsica a un compa\u00f1ero&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(10,&#8217;9&#8242;,&#8217;2015-03-07&#8242;,&#8217;Hurto de material del centro&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(11,&#8217;10&#8217;,&#8217;2015-04-15&#8242;,&#8217;Agresi\u00f3n verbal a un compa\u00f1ero&#8217;);<br \/>\nINSERT INTO DDM_EXPEDIENTES(id, alumno, FechaExpediente, MotivoExpediente) VALUES<br \/>\n(12,&#8217;1&#8242;,&#8217;2015-05-23&#8242;,&#8217;Hurto de material del centro&#8217;);<\/p>\n<p>SELECT * FROM DDM_EXPEDIENTES;<\/p>\n<p>SELECT * FROM DDM_ALUMNOS;<\/p>\n<p>SELECT * FROM DDM_TOTALES;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"966\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_8-9\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_8.png?fit=533%2C205&amp;ssl=1\" data-orig-size=\"533,205\" data-comments-opened=\"1\" data-image-title=\"Screenshot_8\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_8.png?fit=533%2C205&amp;ssl=1\" class=\"size-full wp-image-966 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_8.png?resize=533%2C205&#038;ssl=1\" alt=\"Screenshot_8\" width=\"533\" height=\"205\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_8.png?w=533&amp;ssl=1 533w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_8.png?resize=300%2C115&amp;ssl=1 300w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>TABLA DDM_ALUMNOS CON EL FUNCIONAMIENTO DE LOS <strong>TRIGGER<\/strong>:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"964\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_9-9\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_9.png?fit=565%2C182&amp;ssl=1\" data-orig-size=\"565,182\" data-comments-opened=\"1\" data-image-title=\"Screenshot_9\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_9.png?fit=565%2C182&amp;ssl=1\" class=\"size-full wp-image-964 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_9.png?resize=565%2C182&#038;ssl=1\" alt=\"Screenshot_9\" width=\"565\" height=\"182\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_9.png?w=565&amp;ssl=1 565w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_9.png?resize=300%2C97&amp;ssl=1 300w\" sizes=\"(max-width: 565px) 100vw, 565px\" \/><\/p>\n<p>TABLA DDM_TOTALES CON EL FUNCIONAMIENTO DE TODOS LOS <strong>TRIGGER<\/strong>:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"965\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_10-7\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_10.png?fit=396%2C80&amp;ssl=1\" data-orig-size=\"396,80\" data-comments-opened=\"1\" data-image-title=\"Screenshot_10\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_10.png?fit=396%2C80&amp;ssl=1\" class=\"size-full wp-image-965 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_10.png?resize=396%2C80&#038;ssl=1\" alt=\"Screenshot_10\" width=\"396\" height=\"80\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_10.png?w=396&amp;ssl=1 396w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_10.png?resize=300%2C61&amp;ssl=1 300w\" sizes=\"(max-width: 396px) 100vw, 396px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\/**********************************************************************************************************************************************************************\/<\/p>\n<p>\/*********************************************** \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 CONSULTAS \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0****************************************************************\/<\/p>\n<p>SELECT DDM_ALUMNOS.NombreAlumno AS &#8216;nombre&#8217;, DDM_ALUMNOS.FechaNacimiento AS &#8216;fechanacimiento&#8217;, DDM_EXPEDIENTES.FechaExpediente AS &#8216;fecha&#8217;, DDM_EXPEDIENTES.MotivoExpediente AS &#8216;motivo&#8217;, DDM_TUTORES.NombreResponsable AS &#8216;nombre&#8217;, DDM_TUTORES.Parentesco AS &#8216;parentesco&#8217;, DDM_TUTORES.TelefonoResponsable AS &#8216;telefono&#8217;<br \/>\nFROM DDM_ALUMNOS, DDM_EXPEDIENTES, DDM_TUTORES<br \/>\nWHERE DDM_ALUMNOS.id = DDM_EXPEDIENTES.alumno AND DDM_TUTORES.id = DDM_ALUMNOS.tutor;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"967\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_11-8\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_11.png?fit=1096%2C201&amp;ssl=1\" data-orig-size=\"1096,201\" data-comments-opened=\"1\" data-image-title=\"Screenshot_11\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_11.png?fit=800%2C147&amp;ssl=1\" class=\"size-full wp-image-967 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_11.png?resize=800%2C147&#038;ssl=1\" alt=\"Screenshot_11\" width=\"800\" height=\"147\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_11.png?w=1096&amp;ssl=1 1096w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_11.png?resize=300%2C55&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_11.png?resize=768%2C141&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_11.png?resize=1024%2C188&amp;ssl=1 1024w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_11.png?resize=750%2C138&amp;ssl=1 750w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>SELECT COUNT(DDM_ALUMNOS.id) AS &#8216;N\u00ba TOTAL DE ALUMNOS&#8217;, A.E AS &#8216;N\u00ba TOTAL DE EXPEDIENTES&#8217;<br \/>\nFROM DDM_ALUMNOS, (SELECT COUNT(DDM_EXPEDIENTES.id) AS &#8216;E&#8217;<br \/>\nFROM DDM_EXPEDIENTES) A;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"968\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_12-8\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_12.png?fit=399%2C62&amp;ssl=1\" data-orig-size=\"399,62\" data-comments-opened=\"1\" data-image-title=\"Screenshot_12\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_12.png?fit=399%2C62&amp;ssl=1\" class=\"size-full wp-image-968 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_12.png?resize=399%2C62&#038;ssl=1\" alt=\"Screenshot_12\" width=\"399\" height=\"62\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_12.png?w=399&amp;ssl=1 399w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_12.png?resize=300%2C47&amp;ssl=1 300w\" sizes=\"(max-width: 399px) 100vw, 399px\" \/><\/p>\n<p>SELECT COUNT(DDM_EXPEDIENTES.id) AS &#8216;N\u00ba TOTAL DE EXPEDIENTES&#8217;, C.A AS &#8216;N\u00ba DE EXPEDIENTES 2014&#8217;, Q.A AS &#8216;N\u00ba DE EXPEDIENTES 2015&#8217;<br \/>\nFROM DDM_EXPEDIENTES, (SELECT COUNT(DDM_EXPEDIENTES.id) AS &#8216;A&#8217;<br \/>\nFROM DDM_EXPEDIENTES<br \/>\nWHERE YEAR(DDM_EXPEDIENTES.FechaExpediente) = &#8216;2014&#8217;) C, (SELECT COUNT(DDM_EXPEDIENTES.id) AS &#8216;A&#8217;<br \/>\nFROM DDM_EXPEDIENTES<br \/>\nWHERE YEAR(DDM_EXPEDIENTES.FechaExpediente) = &#8216;2015&#8217;) Q;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"970\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_13-7\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_13.png?fit=625%2C63&amp;ssl=1\" data-orig-size=\"625,63\" data-comments-opened=\"1\" data-image-title=\"Screenshot_13\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_13.png?fit=625%2C63&amp;ssl=1\" class=\"size-full wp-image-970 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_13.png?resize=625%2C63&#038;ssl=1\" alt=\"Screenshot_13\" width=\"625\" height=\"63\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_13.png?w=625&amp;ssl=1 625w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_13.png?resize=300%2C30&amp;ssl=1 300w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>SELECT COUNT(DDM_ALUMNOS.id) AS &#8216;N\u00ba TOTAL DE ALUMNOS&#8217;, S.A AS &#8216;N\u00ba DE ALUMNOS MAYORES DE EDAD&#8217;, ROUND ((S.A\/COUNT(DDM_ALUMNOS.NombreAlumno))*100,2) AS &#8216;PORCENTAJE&#8217;<br \/>\nFROM DDM_ALUMNOS, (SELECT COUNT(DDM_ALUMNOS.NombreAlumno) AS &#8216;A&#8217;<br \/>\nFROM DDM_ALUMNOS<br \/>\nWHERE TRUNCATE((TO_DAYS(SYSDATE()) &#8211; TO_DAYS(DDM_ALUMNOS.Fechanacimiento)) \/ 365.25,0) &gt; 17) S;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"971\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_14-5\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_14.png?fit=547%2C65&amp;ssl=1\" data-orig-size=\"547,65\" data-comments-opened=\"1\" data-image-title=\"Screenshot_14\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_14.png?fit=547%2C65&amp;ssl=1\" class=\"size-full wp-image-971 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_14.png?resize=547%2C65&#038;ssl=1\" alt=\"Screenshot_14\" width=\"547\" height=\"65\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_14.png?w=547&amp;ssl=1 547w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_14.png?resize=300%2C36&amp;ssl=1 300w\" sizes=\"(max-width: 547px) 100vw, 547px\" \/><\/p>\n<p>SELECT DDM_ALUMNOS.NombreAlumno AS &#8216;Alumno M\u00e1s Viejo&#8217;, DDM_ALUMNOS.FechaNacimiento AS &#8216;Nacimiento Alumno M\u00e1s Viejo&#8217;, A.B AS &#8216;Alumno M\u00e1s Joven&#8217;, A.C AS &#8216;Nacimiento Alumno M\u00e1s Joven&#8217;<br \/>\nFROM DDM_ALUMNOS, (SELECT DDM_ALUMNOS.NombreAlumno AS &#8216;B&#8217;, DDM_ALUMNOS.FechaNacimiento AS &#8216;C&#8217;<br \/>\nFROM DDM_ALUMNOS<br \/>\nWHERE DDM_ALUMNOS.FechaNacimiento IN(SELECT MAX(DDM_ALUMNOS.FechaNacimiento)<br \/>\nFROM DDM_ALUMNOS)) A<br \/>\nWHERE DDM_ALUMNOS.FechaNacimiento IN(SELECT MIN(DDM_ALUMNOS.FechaNacimiento)<br \/>\nFROM DDM_ALUMNOS);<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"972\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_15-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_15.png?fit=796%2C61&amp;ssl=1\" data-orig-size=\"796,61\" data-comments-opened=\"1\" data-image-title=\"Screenshot_15\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_15.png?fit=796%2C61&amp;ssl=1\" class=\"size-full wp-image-972 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_15.png?resize=796%2C61&#038;ssl=1\" alt=\"Screenshot_15\" width=\"796\" height=\"61\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_15.png?w=796&amp;ssl=1 796w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_15.png?resize=300%2C23&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_15.png?resize=768%2C59&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_15.png?resize=750%2C57&amp;ssl=1 750w\" sizes=\"(max-width: 796px) 100vw, 796px\" \/><\/p>\n<p>SELECT DDM_TUTORES.NombreResponsable , DDM_TUTORES.parentesco, COUNT(DDM_ALUMNOS.tutor) AS &#8216;N\u00ba de DDM_ALUMNOS tutelados&#8217;<br \/>\nFROM DDM_TUTORES,DDM_ALUMNOS<br \/>\nWHERE DDM_TUTORES.id = DDM_ALUMNOS.tutor<br \/>\nGROUP BY DDM_TUTORES.NombreResponsable, DDM_TUTORES.parentesco<br \/>\nHAVING COUNT(DDM_ALUMNOS.tutor) = (SELECT MAX(GG.A) FROM (<br \/>\nSELECT COUNT(DDM_ALUMNOS.tutor) AS A<br \/>\nFROM DDM_TUTORES,DDM_ALUMNOS<br \/>\nWHERE DDM_TUTORES.id = DDM_ALUMNOS.tutor<br \/>\nGROUP BY DDM_TUTORES.NombreResponsable, DDM_TUTORES.parentesco) GG);<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"973\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_16-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_16.png?fit=528%2C68&amp;ssl=1\" data-orig-size=\"528,68\" data-comments-opened=\"1\" data-image-title=\"Screenshot_16\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_16.png?fit=528%2C68&amp;ssl=1\" class=\"size-full wp-image-973 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_16.png?resize=528%2C68&#038;ssl=1\" alt=\"Screenshot_16\" width=\"528\" height=\"68\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_16.png?w=528&amp;ssl=1 528w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_16.png?resize=300%2C39&amp;ssl=1 300w\" sizes=\"(max-width: 528px) 100vw, 528px\" \/><\/p>\n<p>\/**********************************************************************************************************************************************************************\/<\/p>\n<p>\/*********************************************** \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0FUNCIONES Y PROCEDURES \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ****************************************************************\/<\/p>\n<p>DROP PROCEDURE IF EXISTS NUMEXPEDIENTES;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE PROCEDURE NUMEXPEDIENTES(IN nombre VARCHAR(250), OUT expediente TEXT)<br \/>\nBEGIN<\/p>\n<p>DECLARE motivo TEXT DEFAULT &#8220;&#8221;;<br \/>\nDECLARE contador INT DEFAULT 0;<br \/>\nDECLARE numexp INT DEFAULT 0;<\/p>\n<p>SET numexp = (SELECT COUNT(DDM_EXPEDIENTES.alumno)<br \/>\nFROM DDM_EXPEDIENTES, DDM_ALUMNOS<br \/>\nWHERE DDM_EXPEDIENTES.alumno = DDM_ALUMNOS.id AND DDM_ALUMNOS.NombreAlumno LIKE nombre);<br \/>\nIF numexp &gt; 0 THEN<br \/>\nSET expediente = CONCAT(&#8216;El alumno &#8216;,nombre,&#8217; TIENE &#8216;,numexp,&#8217; expedientes\\n&#8217;);<br \/>\nELSE<br \/>\nSET expediente = CONCAT(&#8216;El alumno &#8216;,nombre,&#8217; tiene&#8217;,numexp,&#8217; expedientes&#8217;);<br \/>\nEND IF;<\/p>\n<p>WHILE contador &lt; numexp DO<br \/>\nSET motivo = (SELECT DDM_EXPEDIENTES.MotivoExpediente<br \/>\nFROM DDM_EXPEDIENTES, DDM_ALUMNOS<br \/>\nWHERE DDM_EXPEDIENTES.alumno = DDM_ALUMNOS.id AND DDM_ALUMNOS.NombreAlumno LIKE nombre LIMIT contador,1);<\/p>\n<p>SET expediente = CONCAT(expediente,&#8217;&#8230;.&#8217;,contador+1,&#8217; +&#8217;,motivo,&#8217;\\n&#8217;);<br \/>\nSET contador = contador + 1;<\/p>\n<p>END WHILE;<\/p>\n<p>END \/\/<\/p>\n<p>DELIMITER ;<\/p>\n<p>CALL NUMEXPEDIENTES(&#8216;Alba Grau P\u00e9rez&#8217;,@a);<br \/>\nSELECT @a;<\/p>\n<p>CALL NUMEXPEDIENTES(&#8216;Pablo Gea Sanz&#8217;,@a);<br \/>\nSELECT @a;<\/p>\n<p>CALL NUMEXPEDIENTES(&#8216;Rafael Gil Rilo&#8217;,@a);<br \/>\nSELECT @a;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"974\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_17-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_17.png?fit=1332%2C479&amp;ssl=1\" data-orig-size=\"1332,479\" data-comments-opened=\"1\" data-image-title=\"Screenshot_17\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_17.png?fit=800%2C288&amp;ssl=1\" class=\"size-full wp-image-974 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_17.png?resize=800%2C288&#038;ssl=1\" alt=\"Screenshot_17\" width=\"800\" height=\"288\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_17.png?w=1332&amp;ssl=1 1332w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_17.png?resize=300%2C108&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_17.png?resize=768%2C276&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_17.png?resize=1024%2C368&amp;ssl=1 1024w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_17.png?resize=750%2C270&amp;ssl=1 750w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>DROP PROCEDURE IF EXISTS TUTORES;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE PROCEDURE TUTORES(IN nombre VARCHAR(250), OUT resultado TEXT)<br \/>\nBEGIN<\/p>\n<p>DECLARE tutor TEXT DEFAULT &#8220;&#8221;;<br \/>\nDECLARE contador INT DEFAULT 0;<br \/>\nDECLARE numtute INT DEFAULT 0;<br \/>\nSET numtute = (SELECT COUNT(DDM_ALUMNOS.id)<br \/>\nFROM DDM_ALUMNOS, DDM_TUTORES<br \/>\nWHERE DDM_ALUMNOS.tutor = DDM_TUTORES.id AND DDM_TUTORES.NombreResponsable LIKE nombre);<\/p>\n<p>IF numtute &gt; 0 THEN<br \/>\nSET resultado = CONCAT(&#8216;El tutor: &#8216;,nombre,&#8217; tiene &#8216;,numtute,&#8217; tutelados.\\n&#8217;);<br \/>\nELSE<br \/>\nSET resultado = CONCAT(&#8216;El tutor: &#8216;,nombre,&#8217; tiene &#8216;,numtute,&#8217; tutelado.\\n&#8217;);<br \/>\nEND IF;<\/p>\n<p>WHILE contador &lt; numtute DO<br \/>\nSET tutor = (SELECT DDM_ALUMNOS.NombreAlumno<br \/>\nFROM DDM_ALUMNOS, DDM_TUTORES<br \/>\nWHERE DDM_ALUMNOS.tutor = DDM_TUTORES.id AND DDM_TUTORES.NombreResponsable LIKE nombre LIMIT contador, 1);<br \/>\nSET resultado = CONCAT(resultado,&#8217;&#8230;&#8217;,contador + 1,&#8217; +&#8217;,tutor,&#8217;\\n&#8217;);<br \/>\nSET contador = contador + 1;<\/p>\n<p>END WHILE;<br \/>\nEND \/\/<\/p>\n<p>DELIMITER ;<\/p>\n<p>CALL TUTORES(&#8216;Alberto L\u00f3pez Gala&#8217;,@b);<br \/>\nSELECT @b;<\/p>\n<p>CALL TUTORES(&#8216;Antonio Abad P\u00e9rez&#8217;,@b);<br \/>\nSELECT @b;<\/p>\n<p>CALL TUTORES(&#8216;Alicia V\u00e1zquez Egea&#8217;,@b);<br \/>\nSELECT @b;<\/p>\n<p>CALL TUTORES(&#8216;Jos\u00e9 Mateo Soto&#8217;,@b);<br \/>\nSELECT @b;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"975\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_18-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_18.png?fit=748%2C631&amp;ssl=1\" data-orig-size=\"748,631\" data-comments-opened=\"1\" data-image-title=\"Screenshot_18\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_18.png?fit=748%2C631&amp;ssl=1\" class=\"size-full wp-image-975 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_18.png?resize=748%2C631&#038;ssl=1\" alt=\"Screenshot_18\" width=\"748\" height=\"631\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_18.png?w=748&amp;ssl=1 748w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_18.png?resize=300%2C253&amp;ssl=1 300w\" sizes=\"(max-width: 748px) 100vw, 748px\" \/><\/p>\n<p>DROP FUNCTION IF EXISTS FTUTORES;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE FUNCTION FTUTORES( nombre VARCHAR(250) )<br \/>\nRETURNS TEXT<\/p>\n<p>BEGIN<\/p>\n<p>DECLARE alum TEXT DEFAULT &#8220;&#8221;;<br \/>\nDECLARE contador INT DEFAULT 0;<br \/>\nDECLARE numalu INT DEFAULT 0;<br \/>\nDECLARE resultado TEXT DEFAULT &#8220;&#8221;;<\/p>\n<p>SET numalu = (SELECT COUNT(DDM_TUTORES.id)<br \/>\nFROM DDM_TUTORES, DDM_ALUMNOS<br \/>\nWHERE DDM_ALUMNOS.tutor = DDM_TUTORES.id AND DDM_TUTORES.NombreResponsable LIKE nombre);<\/p>\n<p>IF numalu &gt; 0 THEN<br \/>\nSET resultado = CONCAT(&#8216;El tutor: &#8216;,nombre,&#8217; tiene &#8216;,numalu,&#8217; tutelados\\n&#8217;);<br \/>\nELSE<br \/>\nSET resultado = CONCAT(&#8216;El tutor: &#8216;,nombre,&#8217; no tiene ningun alumno tutelado\\n&#8217;);<br \/>\nEND IF;<\/p>\n<p>WHILE contador &lt; numalu DO<br \/>\nSET alum = (SELECT DDM_ALUMNOS.NombreAlumno<br \/>\nFROM DDM_ALUMNOS, DDM_TUTORES<br \/>\nWHERE DDM_ALUMNOS.tutor = DDM_TUTORES.id AND DDM_TUTORES.NombreResponsable LIKE nombre LIMIT contador, 1);<br \/>\nSET resultado = CONCAT(resultado,&#8217;&#8212;&gt;&#8217;,contador + 1,&#8217; +&#8217;,alum,&#8217;\\n&#8217;);<br \/>\nSET contador = contador + 1;<br \/>\nEND WHILE;<\/p>\n<p>RETURN(resultado);<\/p>\n<p>END \/\/<\/p>\n<p>DELIMITER ;<\/p>\n<p>SELECT FTUTORES(&#8216;Jos\u00e9 Mateo Soto&#8217;);<\/p>\n<p>SELECT FTUTORES(&#8216;Alicia V\u00e1zquez Egea&#8217;);<\/p>\n<p>SELECT FTUTORES(&#8216;Antonio Abad P\u00e9rez&#8217;);<\/p>\n<p>SELECT FTUTORES(&#8216;Alberto L\u00f3pez Gala&#8217;);<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"976\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_19-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_19.png?fit=745%2C515&amp;ssl=1\" data-orig-size=\"745,515\" data-comments-opened=\"1\" data-image-title=\"Screenshot_19\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_19.png?fit=745%2C515&amp;ssl=1\" class=\"size-full wp-image-976 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_19.png?resize=745%2C515&#038;ssl=1\" alt=\"Screenshot_19\" width=\"745\" height=\"515\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_19.png?w=745&amp;ssl=1 745w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_19.png?resize=300%2C207&amp;ssl=1 300w\" sizes=\"(max-width: 745px) 100vw, 745px\" \/><\/p>\n<p>\/* ************************************************************************************************************ *\/<br \/>\n\/* ************************************ CASE **************************************************************** *\/<\/p>\n<p>DROP FUNCTION IF EXISTS NOMBRETUTOR;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE FUNCTION NOMBRETUTOR(nombre INT)<\/p>\n<p>RETURNS TEXT<\/p>\n<p>BEGIN<\/p>\n<p>DECLARE nombretotal TEXT DEFAULT &#8216;NO FUNCIONA&#8217;;<\/p>\n<p>CASE nombre<br \/>\nWHEN 1 THEN SET nombretotal = &#8216;Jose&#8217;;<br \/>\nWHEN 2 THEN SET nombretotal = &#8216;David&#8217;;<br \/>\nELSE<br \/>\nSET nombretotal = &#8216;EL NUMERO DEL MES INTRODUCIDO ES INCORRECTO DEBE SER UN NUMERO DEL 1 AL 2&#8217;;<br \/>\nEND CASE;<\/p>\n<p>RETURN(nombretotal);<\/p>\n<p>END \/\/<\/p>\n<p>DELIMITER ;<\/p>\n<p>SELECT NOMBRETUTOR(&#8216;1&#8217;);<\/p>\n<p>SELECT NOMBRETUTOR(&#8216;2&#8217;);<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"977\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_20-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_20.png?fit=269%2C234&amp;ssl=1\" data-orig-size=\"269,234\" data-comments-opened=\"1\" data-image-title=\"Screenshot_20\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_20.png?fit=269%2C234&amp;ssl=1\" class=\"size-full wp-image-977 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_20.png?resize=269%2C234&#038;ssl=1\" alt=\"Screenshot_20\" width=\"269\" height=\"234\" \/><\/p>\n<p>\/*************************************************************************************************************\/<br \/>\n\/********************************************** MID procedure ***********************************************\/<\/p>\n<p>DROP PROCEDURE IF EXISTS NOMBREMID;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE PROCEDURE NOMBREMID(IN nombre VARCHAR(250), OUT resultado TEXT)<br \/>\nBEGIN<br \/>\nDECLARE contador INT DEFAULT 0;<br \/>\nDECLARE numletras TEXT DEFAULT &#8220;&#8221;;<br \/>\nDECLARE consumid TEXT DEFAULT &#8220;&#8221;;<\/p>\n<p>SET numletras = (SELECT CHARACTER_LENGTH(nombre));<br \/>\nSET resultado = CONCAT(&#8216;El nombre introducido tiene: &#8216;,numletras,&#8217;caracteres\\n&#8217;);<br \/>\nWHILE contador &lt; numletras DO<br \/>\nSET consumid = (SELECT MID(nombre,contador + 1,1));<br \/>\nSET resultado = CONCAT(resultado,&#8217; Letra: &#8216;,consumid);<br \/>\nSET contador = contador + 1;<\/p>\n<p>END WHILE;<\/p>\n<p>END \/\/<\/p>\n<p>DELIMITER ;<\/p>\n<p>CALL NOMBREMID(&#8216;David&#8217;,@c);<br \/>\nSELECT @c;<\/p>\n<p>CALL NOMBREMID(&#8216;Jara&#8217;,@c);<br \/>\nSELECT @c;<\/p>\n<p>CALL NOMBREMID(&#8216;Fernando&#8217;,@c);<\/p>\n<p>SELECT @c;<\/p>\n<p>CALL NOMBREMID(&#8216;Jose&#8217;,@c);<br \/>\nSELECT @c;<\/p>\n<p>CALL NOMBREMID(&#8216;Adrian&#8217;,@c);<br \/>\nSELECT @c;<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"978\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_21-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_21.png?fit=946%2C778&amp;ssl=1\" data-orig-size=\"946,778\" data-comments-opened=\"1\" data-image-title=\"Screenshot_21\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_21.png?fit=800%2C658&amp;ssl=1\" class=\"size-full wp-image-978 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_21.png?resize=800%2C658&#038;ssl=1\" alt=\"Screenshot_21\" width=\"800\" height=\"658\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_21.png?w=946&amp;ssl=1 946w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_21.png?resize=300%2C247&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_21.png?resize=768%2C632&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_21.png?resize=750%2C617&amp;ssl=1 750w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>\/*************************************************************************************************************\/<br \/>\n\/********************************************** MID FUNCION ***********************************************\/<\/p>\n<p>DROP FUNCTION IF EXISTS NOMBREMIDF;<\/p>\n<p>DELIMITER \/\/<\/p>\n<p>CREATE FUNCTION NOMBREMIDF(nombre VARCHAR(250))<br \/>\nRETURNS TEXT<br \/>\nBEGIN<br \/>\nDECLARE contador INT DEFAULT 0;<br \/>\nDECLARE numletras TEXT DEFAULT &#8220;&#8221;;<br \/>\nDECLARE consumid TEXT DEFAULT &#8220;&#8221;;<br \/>\nDECLARE resultado TEXT DEFAULT &#8220;&#8221;;<\/p>\n<p>SET numletras = (SELECT LENGTH(nombre));<br \/>\nSET resultado = CONCAT(&#8216;El nombre introducido: &#8216;,nombre,&#8217; tiene &#8216;,numletras,&#8217; caracteres. \\n&#8217;);<br \/>\nWHILE contador &lt; numletras DO<br \/>\nSET consumid = (SELECT MID(nombre,contador + 1,1));<br \/>\nSET resultado = CONCAT(resultado,&#8217; Letra: &#8216;,consumid);<br \/>\nSET contador = contador + 1;<\/p>\n<p>END WHILE;<\/p>\n<p>RETURN(resultado);<\/p>\n<p>END \/\/<\/p>\n<p>DELIMITER ;<\/p>\n<p>SELECT NOMBREMIDF(&#8216;David&#8217;);<\/p>\n<p>SELECT NOMBREMIDF(&#8216;Jara&#8217;);<\/p>\n<p>SELECT NOMBREMIDF(&#8216;Fernando&#8217;);<\/p>\n<p>SELECT NOMBREMIDF(&#8216;Jose&#8217;);<\/p>\n<p>SELECT NOMBREMIDF(&#8216;Adrian&#8217;);<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"979\" data-permalink=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/screenshot_22-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_22.png?fit=1042%2C593&amp;ssl=1\" data-orig-size=\"1042,593\" data-comments-opened=\"1\" data-image-title=\"Screenshot_22\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_22.png?fit=800%2C455&amp;ssl=1\" class=\"size-full wp-image-979 aligncenter\" src=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_22.png?resize=800%2C455&#038;ssl=1\" alt=\"Screenshot_22\" width=\"800\" height=\"455\" srcset=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_22.png?w=1042&amp;ssl=1 1042w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_22.png?resize=300%2C171&amp;ssl=1 300w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_22.png?resize=768%2C437&amp;ssl=1 768w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_22.png?resize=1024%2C583&amp;ssl=1 1024w, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/Screenshot_22.png?resize=750%2C427&amp;ssl=1 750w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Gracias por leer el blog. Saludos, @DavidDeMaya.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hola buenas hoy os traigo un peque\u00f1o ejercicio de bases de datos relacionales, el cual os voy a ense\u00f1ar el resultado del c\u00f3digo programado.<\/p>\n","protected":false},"author":1,"featured_media":956,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3],"tags":[74,75,76],"class_list":["post-955","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-guias","tag-bases","tag-datos","tag-mysql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones. - Hardsoft Security<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones. - Hardsoft Security\" \/>\n<meta property=\"og:description\" content=\"Hola buenas hoy os traigo un peque\u00f1o ejercicio de bases de datos relacionales, el cual os voy a ense\u00f1ar el resultado del c\u00f3digo programado.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/\" \/>\n<meta property=\"og:site_name\" content=\"Hardsoft Security\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/HardSoftDavid\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-10T23:36:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"413\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"david\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DavidDeMaya\" \/>\n<meta name=\"twitter:site\" content=\"@DavidDeMaya\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"david\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/\"},\"author\":{\"name\":\"david\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#\\\/schema\\\/person\\\/dfe289b1e4ae2daf72695e85a8b3dd7a\"},\"headline\":\"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones.\",\"datePublished\":\"2016-06-10T23:36:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/\"},\"wordCount\":1980,\"commentCount\":1,\"image\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/hardsoftsecurity.es\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1\",\"keywords\":[\"bases\",\"datos\",\"mysql\"],\"articleSection\":[\"Gu\u00edas\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/\",\"url\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/\",\"name\":\"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones. - Hardsoft Security\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/hardsoftsecurity.es\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1\",\"datePublished\":\"2016-06-10T23:36:43+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#\\\/schema\\\/person\\\/dfe289b1e4ae2daf72695e85a8b3dd7a\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/hardsoftsecurity.es\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/hardsoftsecurity.es\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1\",\"width\":800,\"height\":413},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/index.php\\\/2016\\\/06\\\/10\\\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\\\/\\\/hardsoftsecurity.es\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#website\",\"url\":\"https:\\\/\\\/hardsoftsecurity.es\\\/\",\"name\":\"Hardsoft Security\",\"description\":\"Chasing (In)Security\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/hardsoftsecurity.es\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/hardsoftsecurity.es\\\/#\\\/schema\\\/person\\\/dfe289b1e4ae2daf72695e85a8b3dd7a\",\"name\":\"david\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g\",\"caption\":\"david\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones. - Hardsoft Security","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/","og_locale":"es_ES","og_type":"article","og_title":"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones. - Hardsoft Security","og_description":"Hola buenas hoy os traigo un peque\u00f1o ejercicio de bases de datos relacionales, el cual os voy a ense\u00f1ar el resultado del c\u00f3digo programado.","og_url":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/","og_site_name":"Hardsoft Security","article_publisher":"https:\/\/www.facebook.com\/HardSoftDavid","article_published_time":"2016-06-10T23:36:43+00:00","og_image":[{"width":800,"height":413,"url":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1","type":"image\/jpeg"}],"author":"david","twitter_card":"summary_large_image","twitter_creator":"@DavidDeMaya","twitter_site":"@DavidDeMaya","twitter_misc":{"Escrito por":"david","Tiempo de lectura":"11 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/#article","isPartOf":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/"},"author":{"name":"david","@id":"https:\/\/hardsoftsecurity.es\/#\/schema\/person\/dfe289b1e4ae2daf72695e85a8b3dd7a"},"headline":"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones.","datePublished":"2016-06-10T23:36:43+00:00","mainEntityOfPage":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/"},"wordCount":1980,"commentCount":1,"image":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1","keywords":["bases","datos","mysql"],"articleSection":["Gu\u00edas"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/","url":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/","name":"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones. - Hardsoft Security","isPartOf":{"@id":"https:\/\/hardsoftsecurity.es\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/#primaryimage"},"image":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1","datePublished":"2016-06-10T23:36:43+00:00","author":{"@id":"https:\/\/hardsoftsecurity.es\/#\/schema\/person\/dfe289b1e4ae2daf72695e85a8b3dd7a"},"breadcrumb":{"@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/#primaryimage","url":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1","contentUrl":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1","width":800,"height":413},{"@type":"BreadcrumbList","@id":"https:\/\/hardsoftsecurity.es\/index.php\/2016\/06\/10\/bases-de-datos-relacionales-mysql-diseno-fisico-triggers-insertado-de-datos-consultas-procedures-y-funciones\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/hardsoftsecurity.es\/"},{"@type":"ListItem","position":2,"name":"Bases De Datos Relacionales, MYSQL. Dise\u00f1o F\u00edsico, Triggers, Insertado De Datos, Consultas, Procedures y Funciones."}]},{"@type":"WebSite","@id":"https:\/\/hardsoftsecurity.es\/#website","url":"https:\/\/hardsoftsecurity.es\/","name":"Hardsoft Security","description":"Chasing (In)Security","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hardsoftsecurity.es\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Person","@id":"https:\/\/hardsoftsecurity.es\/#\/schema\/person\/dfe289b1e4ae2daf72695e85a8b3dd7a","name":"david","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/868972cb4e72674a12503e080ee081285c7df2fde82787c96a74bca20781cad7?s=96&d=mm&r=g","caption":"david"}}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7xGFx-fp","jetpack-related-posts":[{"id":1465,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2018\/02\/13\/como-hacer-mysql-mas-seguro\/","url_meta":{"origin":955,"position":0},"title":"\u00bfC\u00f3mo hacer MySQL m\u00e1s seguro?","author":"david","date":"febrero 13, 2018","format":false,"excerpt":"Hola a tod@s hoy os traigo una peque\u00f1a entrada donde vamos a ver como hacer nuestro servidor de MySQL m\u00e1s seguro, esto nos permitir\u00e1 tener un control completo de nuestro servidor, ya que en estos tiempos existen much\u00edsimos bots continuamente escaneando la red para atacar nuestros servicios. Voy a dar\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3638,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2024\/01\/25\/como-usar-sqlmap-guia-con-caso-practico\/","url_meta":{"origin":955,"position":1},"title":"\u00bfC\u00f3mo usar SQLMap? Gu\u00eda con caso pr\u00e1ctico.","author":"david","date":"enero 25, 2024","format":false,"excerpt":"\u00a1Hola! Hoy vamos a sumergirnos en el fascinante mundo de SQLMap, una herramienta indispensable para aquellos que se dedican a garantizar la seguridad de las bases de datos y, por supuesto, para los curiosos del pentesting. Imagina tener una navaja suiza que puede detectar y explotar vulnerabilidades en bases de\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/01\/image-2.png?fit=724%2C362&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/01\/image-2.png?fit=724%2C362&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/01\/image-2.png?fit=724%2C362&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2024\/01\/image-2.png?fit=724%2C362&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":1611,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2018\/06\/25\/explicacion-de-honeypot-e-instalacion-de-kippo-y-kippo-graph\/","url_meta":{"origin":955,"position":2},"title":"Explicaci\u00f3n de Honeypot e instalaci\u00f3n de kippo y kippo-graph.","author":"david","date":"junio 25, 2018","format":false,"excerpt":"Hola tod@s, hoy os traigo una entrada, donde explico que es un honeypot, creo que es muy importante implementar este tipo de soluciones en nuestra red, ya que nos permite simular servicios en producci\u00f3n y as\u00ed poder analizar los ataques de los ciberdelincuentes y poder endurecer los servicios que est\u00e1n\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/06\/honeypot_big_logo-c551a80e.png?fit=1000%2C715&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/06\/honeypot_big_logo-c551a80e.png?fit=1000%2C715&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/06\/honeypot_big_logo-c551a80e.png?fit=1000%2C715&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/06\/honeypot_big_logo-c551a80e.png?fit=1000%2C715&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":341,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2015\/02\/08\/pentesting-de-seguridad-comprobar-si-tu-sistema-de-bases-de-datos-es-realmente-vulnerable-a-cve2012-2122\/","url_meta":{"origin":955,"position":3},"title":"Pentesting de seguridad, comprobar si tu sistema de bases de datos es realmente vulnerable a cve:2012-2122","author":"david","date":"febrero 8, 2015","format":false,"excerpt":"Vulnerabilidad en la base de datos Mysql 5.0.51a Vulnerabilidad CVE 2012-2122, la posibilidad de autenticarse como usuario con m\u00e1ximos privilegios (root) \u00fanicamente realizando conexiones simult\u00e1neas, con CUALQUIER contrase\u00f1a introducida como par\u00e1metro y contra un servidor vulnerable. Al cabo de un n\u00famero indeterminado de intentos fallidos, el servidor aceptar\u00e1 la conexi\u00f3n\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"metasploit","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/02\/metasploit.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1438,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2018\/02\/01\/como-explotar-inyeccion-sql-con-sqlmap\/","url_meta":{"origin":955,"position":4},"title":"Como explotar inyecci\u00f3n SQL con SQLmap.","author":"david","date":"febrero 1, 2018","format":false,"excerpt":"Hola a tod@s, aprovechando la anterior entrada\u00a0que trata de la b\u00fasqueda autom\u00e1tica de p\u00e1ginas web vulnerables a inyecciones SQL, aprovechar\u00e9 esta entrada para hacer una gu\u00eda b\u00e1sica de como explotar esta vulnerabilidad con la herramienta SQLmap. As\u00ed describe la web oficial de SQLmap la herramienta: SQLmap es una herramienta de\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/02\/sqlinjection2.png?fit=1140%2C600&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/02\/sqlinjection2.png?fit=1140%2C600&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/02\/sqlinjection2.png?fit=1140%2C600&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/02\/sqlinjection2.png?fit=1140%2C600&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2018\/02\/sqlinjection2.png?fit=1140%2C600&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":1235,"url":"https:\/\/hardsoftsecurity.es\/index.php\/2017\/06\/10\/hardening-centro-datos\/","url_meta":{"origin":955,"position":5},"title":"Hardening De Nuestro Centro De Datos.","author":"david","date":"junio 10, 2017","format":false,"excerpt":"Hola a todos, hoy os traigo m\u00ed proyecto de grado superior, en especial el grado superior de Administraci\u00f3n de Sistemas Inform\u00e1ticos en Red, este proyecto esta enfocado a la seguridad de los centro de datos. En el documento del proyecto se explicar\u00e1n algunas soluciones tomadas en un centro de datos\u2026","rel":"","context":"En \u00abGu\u00edas\u00bb","block_context":{"text":"Gu\u00edas","link":"https:\/\/hardsoftsecurity.es\/index.php\/category\/guias\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/12\/cropped-cybersecurity_image.jpg?fit=1200%2C898&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/12\/cropped-cybersecurity_image.jpg?fit=1200%2C898&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/12\/cropped-cybersecurity_image.jpg?fit=1200%2C898&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/12\/cropped-cybersecurity_image.jpg?fit=1200%2C898&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2015\/12\/cropped-cybersecurity_image.jpg?fit=1200%2C898&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"jetpack_likes_enabled":true,"jetpack_featured_media_url":"https:\/\/i0.wp.com\/hardsoftsecurity.es\/wp-content\/uploads\/2016\/06\/mysql-logo-1329320869.jpg?fit=800%2C413&ssl=1","_links":{"self":[{"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/posts\/955","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/comments?post=955"}],"version-history":[{"count":2,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/posts\/955\/revisions"}],"predecessor-version":[{"id":981,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/posts\/955\/revisions\/981"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/media\/956"}],"wp:attachment":[{"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/media?parent=955"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/categories?post=955"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hardsoftsecurity.es\/index.php\/wp-json\/wp\/v2\/tags?post=955"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}