Professional Documents
Culture Documents
nadia@KHYRA c:\xampp
# mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.4.32-MariaDB mariadb.org binary distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [07_practica_nadia]>
MariaDB [07_practica_nadia]> show create table persona;
+---------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--+
| Table | Create Table |
+---------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--+
| persona | CREATE TABLE `persona` (
`idp` int(11) DEFAULT NULL,
`app` varchar(30) DEFAULT NULL,
`amp` varchar(30) DEFAULT NULL,
`edadp` int(11) DEFAULT NULL,
UNIQUE KEY `idp` (`idp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci |
+---------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
--+
1 row in set (0.090 sec)
|
+----------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
+
| persona4 | CREATE TABLE `persona4` (
`id` int(11) NOT NULL,
`nombre` varchar(39) DEFAULT NULL,
`apellidos` varchar(39) DEFAULT NULL,
`edad` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci |
+----------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
+
1 row in set (0.005 sec)
MariaDB [07_practica_nadia]> alter table orden add constraint fk1 foreign key
(id_persona) references persona4(id);
Query OK, 0 rows affected (1.046 sec)
Records: 0 Duplicates: 0 Warnings: 0
|
+----------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
+
| persona4 | CREATE TABLE `persona4` (
`id` int(11) NOT NULL,
`nombre` varchar(39) DEFAULT NULL,
`apellidos` varchar(39) DEFAULT NULL,
`edad` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci |
+----------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
+
1 row in set (0.001 sec)
|
+-------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------------------------------------------------------------------+
| orden | CREATE TABLE `orden` (
`id` int(11) NOT NULL,
`num_orden` int(11) DEFAULT NULL,
`id_persona` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk1` (`id_persona`),
CONSTRAINT `fk1` FOREIGN KEY (`id_persona`) REFERENCES `persona4` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci |
+-------
+----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
------------------------------------------------------------------+
1 row in set (0.001 sec)
MariaDB [07_practica_nadia]>