MariaDB [(none)]> create database Libreria; Query OK, 1 row affected (0.001 sec) MariaDB [(none)]> use Libreria; Database changed MariaDB [Libreria]> show tables; Empty set (0.001 sec) MariaDB [Libreria]> create table Materia(codigomat varchar(4) not null primary key, -> titulo varchar(50) not null -> Nropagina int(5) not null, -> Precio int(7) 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 'int(5) not null, Precio int(7) not null' at line 3 MariaDB [Libreria]> show tables; Empty set (0.000 sec) MariaDB [Libreria]> create table Materia(codigomat varchar(4) not null primary key, -> nombre varchar(50) not null); Query OK, 0 rows affected (0.009 sec) MariaDB [Libreria]> describe Materia; +-----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-------------+------+-----+---------+-------+ | codigomat | varchar(4) | NO | PRI | NULL | | | nombre | varchar(50) | NO | | NULL | | +-----------+-------------+------+-----+---------+-------+ 2 rows in set (0.004 sec) MariaDB [Libreria]> create table Libro(Idlibro varchar(4) not null primary key, -> titulo varchar(50) not null, -> nropagina int(5) not null, -> precio int(5) not null, -> foreign key(codigomat) references materia(codigomat) on delete cascade on update cascade); ERROR 1072 (42000): Key column 'codigomat' doesn't exist in table MariaDB [Libreria]> create table Libro(Idlibro varchar(4) not null primary key, -> titulo varchar(50) not null, -> nropagina int(5) not null, -> precio int(5) not null, -> codigomat varchar(4) not null, -> foreign key(codigomat) references materia(codigomat) on delete cascade on update cascade); Query OK, 0 rows affected (0.013 sec) MariaDB [Libreria]> descibre libro; 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 'descibre libro' at line 1 MariaDB [Libreria]> describe libro; +-----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-------------+------+-----+---------+-------+ | Idlibro | varchar(4) | NO | PRI | NULL | | | titulo | varchar(50) | NO | | NULL | | | nropagina | int(5) | NO | | NULL | | | precio | int(5) | NO | | NULL | | | codigomat | varchar(4) | NO | MUL | NULL | | +-----------+-------------+------+-----+---------+-------+ 5 rows in set (0.004 sec) MariaDB [Libreria]> create table autor(codautor varchar(4) not null primary key, -> nombre varchar(4) not null); Query OK, 0 rows affected (0.009 sec) MariaDB [Libreria]> drop table autor; Query OK, 0 rows affected (0.013 sec) MariaDB [Libreria]> create table autor(codautor varchar(4) not null primary key, -> nombre varchar(15) not null); Query OK, 0 rows affected (0.009 sec) MariaDB [Libreria]> create table editorial(codedit varchar(4) not null primary key, -> nombre varchar(15) not null); Query OK, 0 rows affected (0.008 sec) MariaDB [Libreria]> create table liautedi(idlibro varchar(4) not null, -> codautor varchar(4) 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 '' at line 2 MariaDB [Libreria]> create table liautedi(idlibro varchar(4) not null, -> codautor varchar(4) not null, -> codedit varchar(4) 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.009 sec) MariaDB [Libreria]> describe materia; +-----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-------------+------+-----+---------+-------+ | codigomat | varchar(4) | NO | PRI | NULL | | | nombre | varchar(50) | NO | | NULL | | +-----------+-------------+------+-----+---------+-------+ 2 rows in set (0.003 sec) MariaDB [Libreria]> describe libro; +-----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-------------+------+-----+---------+-------+ | Idlibro | varchar(4) | NO | PRI | NULL | | | titulo | varchar(50) | NO | | NULL | | | nropagina | int(5) | NO | | NULL | | | precio | int(5) | NO | | NULL | | | codigomat | varchar(4) | NO | MUL | NULL | | +-----------+-------------+------+-----+---------+-------+ 5 rows in set (0.004 sec) MariaDB [Libreria]> describe autor; +----------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+-------------+------+-----+---------+-------+ | codautor | varchar(4) | NO | PRI | NULL | | | nombre | varchar(15) | NO | | NULL | | +----------+-------------+------+-----+---------+-------+ 2 rows in set (0.005 sec) MariaDB [Libreria]> describe editorial; +---------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+-------------+------+-----+---------+-------+ | codedit | varchar(4) | NO | PRI | NULL | | | nombre | varchar(15) | NO | | NULL | | +---------+-------------+------+-----+---------+-------+ 2 rows in set (0.004 sec) MariaDB [Libreria]> describe liautedi; +----------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+------------+------+-----+---------+-------+ | idlibro | varchar(4) | NO | MUL | NULL | | | codautor | varchar(4) | NO | MUL | NULL | | | codedit | varchar(4) | NO | MUL | NULL | | +----------+------------+------+-----+---------+-------+ 3 rows in set (0.004 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M01','Calculo'); Query OK, 1 row affected (0.004 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M02','Matematicas'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M03','Estructura de datos'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M04','Ingles'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M05','Diagramacion'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M06','Contabilidad'); Query OK, 1 row affected (0.001 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M07','Redes'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M08','Sistemas de inf'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into materia(codigomat, nombre) values('M09','Base de datos'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into autor(codautor, nombre) values('A01','Luis Joyanes'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into autor(codautor, nombre) values('A02','Jorge Vasquez Posada'); Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [Libreria]> insert into autor(codautor, nombre) values('A03','Jhon Soars'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into autor(codautor, nombre) values('A04','Riaz Khedem'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into autor(codautor, nombre) values('A05','Robert Lorber'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into autor(codautor, nombre) values('A06','Mario Dream'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into editorial(codedit, nombre) values('E01','Oveja Negra'); Query OK, 1 row affected (0.003 sec) MariaDB [Libreria]> insert into editorial(codedit, nombre) values('E02','Norma'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into editorial(codedit, nombre) values('E03','Mc Graw Hill'); Query OK, 1 row affected (0.003 sec) MariaDB [Libreria]> insert into libro(idlibro, titulo, nropaginas, precio, codigomat) values('L01','Calculo II', 120, 55000,'M01'); ERROR 1054 (42S22): Unknown column 'nropaginas' in 'field list' MariaDB [Libreria]> insert into libro(idlibro, titulo, nropagina, precio, codigomat) values('L01','Calculo II', 120, 55000,'M01'); Query OK, 1 row affected (0.003 sec) MariaDB [Libreria]> insert into libro(idlibro, titulo, nropagina, precio, codigomat) values('L02','BD II', 150, 65000,'M09'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into libro(idlibro, titulo, nropagina, precio, codigomat) values('L03','Estructura de Datos', 180, 85000,'M03'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into libro(idlibro, titulo, nropagina, precio, codigomat) values('L04','Ingles', 85, 45000,'M04'); Query OK, 1 row affected (0.001 sec) MariaDB [Libreria]> insert into libro(idlibro, titulo, nropagina, precio, codigomat) values('L05','Admon en una Pagina', 70, 7500,'M05'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into libro(idlibro, titulo, nropagina, precio, codigomat) values('L06','Contabilidad I', 170,27500,'M06'); Query OK, 1 row affected (0.003 sec) MariaDB [Libreria]> insert into libro(idlibro, titulo, nropagina, precio, codigomat) values('L07','Redes', 370,32500,'M07'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into libro(idlibro, titulo, nropagina, precio, codigomat) values('L08','Diagramacion', 280,10500,'M08'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> change: alter table libro change Titulo descripcion 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 ': alter table libro change Titulo descripcion varchar(50) not null' at line 1 MariaDB [Libreria]> alter table libro change Titulo descripcion varchar(50) not null; Query OK, 0 rows affected (0.005 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [Libreria]> describe libro; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | Idlibro | varchar(4) | NO | PRI | NULL | | | descripcion | varchar(50) | NO | | NULL | | | nropagina | int(5) | NO | | NULL | | | precio | int(5) | NO | | NULL | | | codigomat | varchar(4) | NO | MUL | NULL | | +-------------+-------------+------+-----+---------+-------+ 5 rows in set (0.004 sec) MariaDB [Libreria]> select * from libro; +---------+---------------------+-----------+--------+-----------+ | Idlibro | descripcion | nropagina | precio | codigomat | +---------+---------------------+-----------+--------+-----------+ | L01 | Calculo II | 120 | 55000 | M01 | | L02 | BD II | 150 | 65000 | M09 | | L03 | Estructura de Datos | 180 | 85000 | M03 | | L04 | Ingles | 85 | 45000 | M04 | | L05 | Admon en una Pagina | 70 | 7500 | M05 | | L06 | Contabilidad I | 170 | 27500 | M06 | | L07 | Redes | 370 | 32500 | M07 | | L08 | Diagramacion | 280 | 10500 | M08 | +---------+---------------------+-----------+--------+-----------+ 8 rows in set (0.001 sec) MariaDB [Libreria]> select * from materia; +-----------+---------------------+ | codigomat | nombre | +-----------+---------------------+ | M01 | Calculo | | M02 | Matematicas | | M03 | Estructura de datos | | M04 | Ingles | | M05 | Diagramacion | | M06 | Contabilidad | | M07 | Redes | | M08 | Sistemas de inf | | M09 | Base de datos | +-----------+---------------------+ 9 rows in set (0.001 sec) MariaDB [Libreria]> select * autor; 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 'autor' at line 1 MariaDB [Libreria]> select * from autor; +----------+-----------------+ | codautor | nombre | +----------+-----------------+ | A01 | Luis Joyanes | | A02 | Jorge Vasquez P | | A03 | Jhon Soars | | A04 | Riaz Khedem | | A05 | Robert Lorber | | A06 | Mario Dream | +----------+-----------------+ 6 rows in set (0.000 sec) MariaDB [Libreria]> select * from editorial; +---------+--------------+ | codedit | nombre | +---------+--------------+ | E01 | Oveja Negra | | E02 | Norma | | E03 | Mc Graw Hill | +---------+--------------+ 3 rows in set (0.001 sec) MariaDB [Libreria]> select * from liautedi; Empty set (0.001 sec) MariaDB [Libreria]> insert into liautedi(idlibro, codautor, codedit) values('L02','A01','E01'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into liautedi(idlibro, codautor, codedit) values('L02','A05','E03'); Query OK, 1 row affected (0.001 sec) MariaDB [Libreria]> insert into liautedi(idlibro, codautor, codedit) values('L06','A02','E02'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into liautedi(idlibro, codautor, codedit) values('L07','A05','E03'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into liautedi(idlibro, codautor, codedit) values('L04','A04','E01'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> insert into liautedi(idlibro, codautor, codedit) values('L04','A04','E02'); Query OK, 1 row affected (0.001 sec) MariaDB [Libreria]> insert into liautedi(idlibro, codautor, codedit) values('L04','A04','E03'); Query OK, 1 row affected (0.002 sec) MariaDB [Libreria]> select * from libro; +---------+---------------------+-----------+--------+-----------+ | Idlibro | descripcion | nropagina | precio | codigomat | +---------+---------------------+-----------+--------+-----------+ | L01 | Calculo II | 120 | 55000 | M01 | | L02 | BD II | 150 | 65000 | M09 | | L03 | Estructura de Datos | 180 | 85000 | M03 | | L04 | Ingles | 85 | 45000 | M04 | | L05 | Admon en una Pagina | 70 | 7500 | M05 | | L06 | Contabilidad I | 170 | 27500 | M06 | | L07 | Redes | 370 | 32500 | M07 | | L08 | Diagramacion | 280 | 10500 | M08 | +---------+---------------------+-----------+--------+-----------+ 8 rows in set (0.001 sec) MariaDB [Libreria]> select * from materia; +-----------+---------------------+ | codigomat | nombre | +-----------+---------------------+ | M01 | Calculo | | M02 | Matematicas | | M03 | Estructura de datos | | M04 | Ingles | | M05 | Diagramacion | | M06 | Contabilidad | | M07 | Redes | | M08 | Sistemas de inf | | M09 | Base de datos | +-----------+---------------------+ 9 rows in set (0.001 sec) MariaDB [Libreria]> select * from autor; +----------+-----------------+ | codautor | nombre | +----------+-----------------+ | A01 | Luis Joyanes | | A02 | Jorge Vasquez P | | A03 | Jhon Soars | | A04 | Riaz Khedem | | A05 | Robert Lorber | | A06 | Mario Dream | +----------+-----------------+ 6 rows in set (0.001 sec) MariaDB [Libreria]> select * from editorial; +---------+--------------+ | codedit | nombre | +---------+--------------+ | E01 | Oveja Negra | | E02 | Norma | | E03 | Mc Graw Hill | +---------+--------------+ 3 rows in set (0.001 sec) 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 descripcion, precio from libro -> ; +---------------------+--------+ | descripcion | precio | +---------------------+--------+ | Calculo II | 55000 | | BD II | 65000 | | Estructura de Datos | 85000 | | Ingles | 45000 | | Admon en una Pagina | 7500 | | Contabilidad I | 27500 | | Redes | 32500 | | Diagramacion | 10500 | +---------------------+--------+ 8 rows in set (0.000 sec) MariaDB [Libreria]> exit