MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | phpmyadmin | | test | +--------------------+ 5 rows in set (0.001 sec) MariaDB [(none)]> create database libreria; Query OK, 1 row affected (0.059 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | libreria | | mysql | | performance_schema | | phpmyadmin | | test | +--------------------+ 6 rows in set (0.001 sec) MariaDB [(none)]> use libreria; Database changed MariaDB [libreria]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | libreria | | mysql | | performance_schema | | phpmyadmin | | test | +--------------------+ 6 rows in set (0.001 sec) MariaDB [libreria]> create table Libro; ERROR 1113 (42000): A table must have at least 1 column MariaDB [libreria]> create table Libro, -> (idlibro varchar(50) not null primary key, -> Titulo varchar(50) not null, -> Nropagina int not null, -> Precio int not null, -> Codigomat varchar(50) not null); 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 ' (idlibro varchar(50) not null primary key, Titulo varchar(50) not null, Nropag' at line 1 MariaDB [libreria]> create table Libro -> (idlibro varchar(50) not null primary key, -> Titulo varchar(50) not null, -> Nropagina int not null, -> Precio int not null, -> Codigomat varchar(50) not null); Query OK, 0 rows affected (0.266 sec) MariaDB [libreria]> alter table Libro change Titulo Descripcion varchar(50) not null; Query OK, 0 rows affected (0.157 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [libreria]> show tables; +--------------------+ | Tables_in_libreria | +--------------------+ | libro | +--------------------+ 1 row in set (0.001 sec) MariaDB [libreria]> describe Libro; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | idlibro | varchar(50) | NO | PRI | NULL | | | Descripcion | varchar(50) | NO | | NULL | | | Nropagina | int(11) | NO | | NULL | | | Precio | int(11) | NO | | NULL | | | Codigomat | varchar(50) | NO | | NULL | | +-------------+-------------+------+-----+---------+-------+ 5 rows in set (0.024 sec) MariaDB [libreria]> create table Materia -> (Codigomat varchar(50) not null, -> Nombre varchar(50) not null, -> foreign key(Codigomat) references libro(Codigomat) on delete cascade on update cascade); ERROR 1005 (HY000): Can't create table `libreria`.`materia` (errno: 150 "Foreign key constraint is incorrectly formed") MariaDB [libreria]> foreign key(Codigomat) references Libro(Codigomat) on delete cascade on update cascade); 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 'foreign key(Codigomat) references Libro(Codigomat) on delete cascade on update c' at line 1 MariaDB [libreria]> create table Materia -> (Codigomat varchar(50) not null, -> Nombre varchar(50) not null, -> foreign key(Codigomat) references Libro(Codigomat) on delete cascade on update cascade); ERROR 1005 (HY000): Can't create table `libreria`.`materia` (errno: 150 "Foreign key constraint is incorrectly formed") MariaDB [libreria]> create table Materia -> (Codigomat varchar(50) not null, -> Nombre varchar(50) not null); Query OK, 0 rows affected (0.191 sec) MariaDB [libreria]> alter table Materia rename to Asignatura; Query OK, 0 rows affected (0.306 sec) MariaDB [libreria]> show tables; +--------------------+ | Tables_in_libreria | +--------------------+ | asignatura | | libro | +--------------------+ 2 rows in set (0.000 sec) MariaDB [libreria]> describe Asignatura; +-----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-------------+------+-----+---------+-------+ | Codigomat | varchar(50) | NO | | NULL | | | Nombre | varchar(50) | NO | | NULL | | +-----------+-------------+------+-----+---------+-------+ 2 rows in set (0.020 sec) MariaDB [libreria]> create table Autor -> (Codautor varchar(50) not null primery key, -> nombre varchar(50) not null); 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 'key, nombre varchar(50) not null)' at line 2 MariaDB [libreria]> create table Autor -> (Codautor varchar(50) not null primary key, -> nombre varchar(50) not null); Query OK, 0 rows affected (0.267 sec) MariaDB [libreria]> show tables; +--------------------+ | Tables_in_libreria | +--------------------+ | asignatura | | autor | | libro | +--------------------+ 3 rows in set (0.000 sec) MariaDB [libreria]> describe Autor; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | Codautor | varchar(50) | NO | PRI | NULL | | | nombre | varchar(50) | NO | | NULL | | +----------+-------------+------+-----+---------+-------+ 2 rows in set (0.019 sec) MariaDB [libreria]> create table Editorial -> (Codedit varchar(50) not null primary key, -> Nombre varchar(50) not null); Query OK, 0 rows affected (0.217 sec) MariaDB [libreria]> show tables; +--------------------+ | Tables_in_libreria | +--------------------+ | asignatura | | autor | | editorial | | libro | +--------------------+ 4 rows in set (0.001 sec) MariaDB [libreria]> describe Editorial; +---------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+-------------+------+-----+---------+-------+ | Codedit | varchar(50) | NO | PRI | NULL | | | Nombre | varchar(50) | NO | | NULL | | +---------+-------------+------+-----+---------+-------+ 2 rows in set (0.019 sec) MariaDB [libreria]> create table LIAUTEDI -> (idlibro varchar(50) not null, -> Codautor varchar(50) not null, -> Codedit varchar(50) not null, -> foreign key(idlibro) references libro(idlibro) on delete cascade on update cascade, -> foreign key(Codautor) references Autor(Codautor) on delete cascade on update cascade, -> foreign key(Codedit) references Editorial(Codedit) on delete cascade on update cascade); Query OK, 0 rows affected (0.461 sec) MariaDB [libreria]> describe LIAUTEDI; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | idlibro | varchar(50) | NO | MUL | NULL | | | Codautor | varchar(50) | NO | MUL | NULL | | | Codedit | varchar(50) | NO | MUL | NULL | | +----------+-------------+------+-----+---------+-------+ 3 rows in set (0.028 sec) MariaDB [libreria]> insert into Libro (idlibro, Descripcion, Nropagina, Precio, Codigomat) values ('L01','calculo',120,55000,'M01'), ('L02','BD II',150,65000,'M09'), ('L03','Estructura de datos',180,85000,'M03'), ('L08','Diagramacion',85,45000,'M08'), ('L05','Admon en una pagina',70,7500,'M05'), ('L06','Contabilidad I',170,27500,'M06'), ('L07','Redes',370,32500,'M07'), ('L04','Ingles',280,105000,'M04'); Query OK, 8 rows affected (0.091 sec) Records: 8 Duplicates: 0 Warnings: 0 MariaDB [libreria]> select* from Libro; +---------+---------------------+-----------+--------+-----------+ | idlibro | Descripcion | Nropagina | Precio | Codigomat | +---------+---------------------+-----------+--------+-----------+ | L01 | calculo | 120 | 55000 | M01 | | L02 | BD II | 150 | 65000 | M09 | | L03 | Estructura de datos | 180 | 85000 | M03 | | L04 | Ingles | 280 | 105000 | M04 | | L05 | Admon en una pagina | 70 | 7500 | M05 | | L06 | Contabilidad I | 170 | 27500 | M06 | | L07 | Redes | 370 | 32500 | M07 | | L08 | Diagramacion | 85 | 45000 | M08 | +---------+---------------------+-----------+--------+-----------+ 8 rows in set (0.000 sec) MariaDB [libreria]> insert into Asignatura (Codigomat, Nombre) values ('M01','Calculo'), ('M02','Matematicas'), ('M03','Estructura de datos'), ('M04','Ingl'), ('M08','Diagramacion'), ('M06','Contabilidad'), ('M07','Redes'), ('M05','Sistemas de Inf.'), ('M09','Base de datos'); Query OK, 9 rows affected (0.087 sec) Records: 9 Duplicates: 0 Warnings: 0 MariaDB [libreria]> select* from Asignatuta; ERROR 1146 (42S02): Table 'libreria.asignatuta' doesn't exist MariaDB [libreria]> select* from Asignatura; +-----------+---------------------+ | Codigomat | Nombre | +-----------+---------------------+ | M01 | Calculo | | M02 | Matematicas | | M03 | Estructura de datos | | M04 | Ingl | | M08 | Diagramacion | | M06 | Contabilidad | | M07 | Redes | | M05 | Sistemas de Inf. | | M09 | Base de datos | +-----------+---------------------+ 9 rows in set (0.001 sec) MariaDB [libreria]> insert into Autor (Codautor, Nombre) values ('A01','Luis Joyanes'), ('A02','Jorge Vasquez Posada'), ('A03','Jhon Soars'), ('A04','Riaz Khadem'), ('A05','Robert Lorber'), ('A06','Mario Dream'); Query OK, 6 rows affected (0.088 sec) Records: 6 Duplicates: 0 Warnings: 0 MariaDB [libreria]> select* from Autor; +----------+----------------------+ | Codautor | nombre | +----------+----------------------+ | A01 | Luis Joyanes | | A02 | Jorge Vasquez Posada | | A03 | Jhon Soars | | A04 | Riaz Khadem | | A05 | Robert Lorber | | A06 | Mario Dream | +----------+----------------------+ 6 rows in set (0.000 sec) MariaDB [libreria]> insert into Editorial (Codedit, Nombre) values ('E01','Oveja Negra'), ('E02','Norma'), ('E03','Mc graw Hill'); Query OK, 3 rows affected (0.051 sec) Records: 3 Duplicates: 0 Warnings: 0 MariaDB [libreria]> select* from Editorial; +---------+--------------+ | Codedit | Nombre | +---------+--------------+ | E01 | Oveja Negra | | E02 | Norma | | E03 | Mc graw Hill | +---------+--------------+ 3 rows in set (0.000 sec) MariaDB [libreria]> select* from LIAUTEDI; Empty set (0.000 sec) MariaDB [libreria]> insert into LIAUTEDI (idlibro, Codautor, Codedit) values ('L02','A01','E01'), ('L02','A05','E03'), ('L06','A02','E02'), ('L07','A05','E03'), ('L04','A04','E01'), ('L04','A04','E02'), ('L04','A04','E03'); Query OK, 7 rows affected (0.154 sec) Records: 7 Duplicates: 0 Warnings: 0 MariaDB [libreria]> select* from LIAUTEDI; +---------+----------+---------+ | idlibro | Codautor | Codedit | +---------+----------+---------+ | L02 | A01 | E01 | | L02 | A05 | E03 | | L06 | A02 | E02 | | L07 | A05 | E03 | | L04 | A04 | E01 | | L04 | A04 | E02 | | L04 | A04 | E03 | +---------+----------+---------+ 7 rows in set (0.000 sec) MariaDB [libreria]> select Precio from libro; +--------+ | Precio | +--------+ | 55000 | | 65000 | | 85000 | | 105000 | | 7500 | | 27500 | | 32500 | | 45000 | +--------+ 8 rows in set (0.000 sec) MariaDB [libreria]> select descripcion, Precio from libro; +---------------------+--------+ | descripcion | Precio | +---------------------+--------+ | calculo | 55000 | | BD II | 65000 | | Estructura de datos | 85000 | | Ingles | 105000 | | Admon en una pagina | 7500 | | Contabilidad I | 27500 | | Redes | 32500 | | Diagramacion | 45000 | +---------------------+--------+ 8 rows in set (0.000 sec) MariaDB [libreria]> mysqldump -B -uroot -p nombre_DB>c:/xampp/Libreria.sql -> ; 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 'mysqldump -B -uroot -p nombre_DB>c:/xampp/Libreria.sql' at line 1 MariaDB [libreria]> mysqldump -B -uroot -p Libreria>c:/xampp/Libreria.sql; 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 'mysqldump -B -uroot -p Libreria>c:/xampp/Libreria.sql' at line 1 MariaDB [libreria]> mysqldump -B -uroot -p Libreria>C:\xampp/Libreria.sql ERROR: Unknown command '\x'. -> mysqldump -B -uroot -p Libreria>c:/xampp/Libreria.sql; 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 'mysqldump -B -uroot -p Libreria>C:\xampp/Libreria.sql mysqldump -B -uroot -p Lib' at line 1 MariaDB [libreria]> mysqldump -B -uroot -p Libreria>c:/xampp/Libreria.sql: -> -> ; 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 'mysqldump -B -uroot -p Libreria>c:/xampp/Libreria.sql:' at line 1 MariaDB [libreria]> exit