Microsoft Windows [Versión 10.0.19045.3570] (c) Microsoft Corporation. Todos los derechos reservados. C:\Windows\system32>mysql -u root -p "mysql" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable. C:\Windows\system32>cd c:/xampp/mysql/bin c:\xampp\mysql\bin>mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 14 Server version: 10.4.28-MariaDB mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database trigger; 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 'trigger' at line 1 MariaDB [(none)]> create database trigger; 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 'trigger' at line 1 MariaDB [(none)]> create trigger; 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 [(none)]> CREATE DATABASE alumnos; Query OK, 1 row affected (0.001 sec) MariaDB [(none)]> CREATE TABLE alumnos ( -> id INT AUTO_INCREMENT PRIMARY KEY, -> nombre VARCHAR(50), -> apellido VARCHAR(50), -> edad INT, -> direccion VARCHAR(100) -> ); ERROR 1046 (3D000): No database selected MariaDB [(none)]> use alumnos; Database changed MariaDB [alumnos]> CREATE TABLE alumnos ( -> id INT AUTO_INCREMENT PRIMARY KEY, -> nombre VARCHAR(50), -> apellido VARCHAR(50), -> edad INT, -> direccion VARCHAR(100) -> ); Query OK, 0 rows affected (0.015 sec) MariaDB [alumnos]> DELIMITER $$ MariaDB [alumnos]> MariaDB [alumnos]> CREATE TRIGGER trigger_alumno_identificador -> BEFORE INSERT ON alumnos -> FOR EACH ROW -> BEGIN -> SET NEW.identificador = CONCAT(NEW.id, '_', NEW.nombre, '_', NEW.apellido); -> END; -> $$ ERROR 1054 (42S22): Unknown column 'identificador' in 'NEW' MariaDB [alumnos]> MariaDB [alumnos]> ALTER TABLE alumnos ADD COLUMN identificador VARCHAR(255); -> ; -> ; -> ;; -> ;; -> ; -> ; -> ; -> ; -> ; -> ; -> ; -> ; -> ; -> ; -> ; -> ; -> ; -> Unknown column 'identificador' in 'NEW'; -> ALTER TABLE alumnos ADD COLUMN identificador VARCHAR(255); -> DELIMITER $$ Query OK, 0 rows affected (0.008 sec) Records: 0 Duplicates: 0 Warnings: 0 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 '; ; ;; ;; ; ; ; ; ; ; ; ; ; ; ; ; ; Unknown column 'identificador' in 'NEW'; ...' at line 1 MariaDB [alumnos]> MariaDB [alumnos]> CREATE TRIGGER trigger_alumno_identificador -> BEFORE INSERT ON alumnos -> FOR EACH ROW -> BEGIN -> SET NEW.identificador = CONCAT(NEW.id, '_', NEW.nombre, '_', NEW.apellido); -> END; -> $$ Query OK, 0 rows affected (0.009 sec) MariaDB [alumnos]> MariaDB [alumnos]> DELIMITER ; MariaDB [alumnos]> INSERT INTO alumnos (nombre, apellido, edad, direccion) VALUES ('Juan', 'Pérez', 20, 'Calle 123'); Query OK, 1 row affected (0.004 sec) MariaDB [alumnos]> SELECT * FROM alumnos; +----+--------+----------+------+-----------+---------------+ | id | nombre | apellido | edad | direccion | identificador | +----+--------+----------+------+-----------+---------------+ | 1 | Juan | Pérez | 20 | Calle 123 | 0_Juan_Pérez | +----+--------+----------+------+-----------+---------------+ 1 row in set (0.000 sec) MariaDB [alumnos]> exit Bye c:\xampp\mysql\bin>mysqldump -u root -p --databases alumnos --events --routines --triggers > pruebatrigger.sql Enter password: c:\xampp\mysql\bin>