MariaDB [matricula2]> show tables; +----------------------+ | Tables_in_matricula2 | +----------------------+ | alumcar | | alumno | | carrera | | matricula | | profcar | | profesor | +----------------------+ 6 rows in set (0.001 sec) MariaDB [matricula2]> select * from alumcar; +---------+----------+ | codestu | codcarre | +---------+----------+ | 001 | 002 | | 003 | 005 | | 005 | 001 | | 001 | 005 | +---------+----------+ 4 rows in set (0.000 sec) MariaDB [matricula2]> select * from alumno; +---------+------------------+-----------+----------+ | codestu | nombre | direccion | telefono | +---------+------------------+-----------+----------+ | 001 | Juan Tobon | Cra 59 | 2335698 | | 002 | Mario Gonzales | Cra 89 | 6325984 | | 003 | Federico Aguilar | Cra 26 | 4569782 | | 004 | Angel Cuadrado | Cra 44 | 6398521 | | 005 | Catalina Escobar | Cra 78 | 4652300 | | 006 | Paulina Borja | Cra 45 | 4599632 | +---------+------------------+-----------+----------+ 6 rows in set (0.009 sec) MariaDB [matricula2]> select * from carrera; +----------+-------------------------+ | codcarre | carrera | +----------+-------------------------+ | 001 | Ingenieria de Sistemas | | 002 | Contaduria | | 003 | Economia | | 004 | Derecho | | 005 | Ingenieria Agropecuaria | | 006 | Agronomia | | 007 | Ciencias de la salud | | 008 | Veterinaria | +----------+-------------------------+ 8 rows in set (0.009 sec) MariaDB [matricula2]> select * from matricula; +----------+---------+----------+----------+---------------+ | codmatri | codestu | codcarre | codprofe | valorsemestre | +----------+---------+----------+----------+---------------+ | 001 | 003 | 004 | 004 | 1800000 | | 002 | 001 | 008 | 003 | 3500000 | | 003 | 004 | 007 | 006 | 2800000 | | 004 | 002 | 007 | 006 | 1950000 | | 005 | 005 | 004 | 001 | 1800000 | | 006 | 003 | 008 | 003 | 3500000 | +----------+---------+----------+----------+---------------+ 6 rows in set (0.001 sec) MariaDB [matricula2]> select * from profcar; +----------+----------+ | codprofe | codcarre | +----------+----------+ | 005 | 003 | | 002 | 006 | | 005 | 005 | | 003 | 008 | | 005 | 001 | | 004 | 002 | | 003 | 001 | | 004 | 004 | | 001 | 004 | | 006 | 007 | +----------+----------+ 10 rows in set (0.000 sec) MariaDB [matricula2]> elect * from profesor; 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 'elect * from profesor' at line 1 MariaDB [matricula2]> select * from profesor; +----------+----------------------+-----------+----------+ | codprofe | nombre | direccion | telefono | +----------+----------------------+-----------+----------+ | 001 | Pablo Juan Gutierrez | cra 45-96 | 2569856 | | 002 | Enrique Saltamontes | cra 25-63 | 2365914 | | 003 | Portacio Cartagena | cra 36-01 | 4596321 | | 004 | Federico Aguilar | cra 56-41 | 7895624 | | 005 | Alberto Cifuentes | cra 20-30 | 7895002 | | 006 | Pascual Bravo | cra 56-41 | 5698741 | +----------+----------------------+-----------+----------+ 6 rows in set (0.009 sec) MariaDB [matricula2]> select profesor.codprofe,profesor.nombre,carrera.carrera from profesor,carrera,profcar where carrera.carrera='Ingenieria de Sistemas'and profesor.codprofe=profcar.codprofe and profcar.codcarre=carrera.codcarre; +----------+--------------------+------------------------+ | codprofe | nombre | carrera | +----------+--------------------+------------------------+ | 005 | Alberto Cifuentes | Ingenieria de Sistemas | | 003 | Portacio Cartagena | Ingenieria de Sistemas | +----------+--------------------+------------------------+ 2 rows in set (0.001 sec) MariaDB [matricula2]> select profesor.codprofe,profesor.nombre,carrera.carrera,alumno.codestu,alumno.nombre from profesor,carrera,matricula,alumno where carrera.carrera='Derecho'and profesor.codprofe=matricula.codprofe and matricula.codcarre=carrera.codcarre and alumno.codestu=matricula.codestu; +----------+----------------------+---------+---------+------------------+ | codprofe | nombre | carrera | codestu | nombre | +----------+----------------------+---------+---------+------------------+ | 004 | Federico Aguilar | Derecho | 003 | Federico Aguilar | | 001 | Pablo Juan Gutierrez | Derecho | 005 | Catalina Escobar | +----------+----------------------+---------+---------+------------------+ 2 rows in set (0.001 sec) MariaDB [matricula2]> select matricula.valorsemestre,carrera.carrera,alumno.codestu from alumno,carrera,matricula where carrera.carrera='Veterinaria' and alumno.codestu=matricula.codestu and carrera.codcarre=matricula.codcarre; +---------------+-------------+---------+ | valorsemestre | carrera | codestu | +---------------+-------------+---------+ | 3500000 | Veterinaria | 001 | | 3500000 | Veterinaria | 003 | +---------------+-------------+---------+ 2 rows in set (0.001 sec) MariaDB [matricula2]> select alumno.nombre,profesor.nombre from alumno,profesor,matricula where profesor.nombre='Portacio Cartagena' and alumno.codestu=matricula.codestu and profesor.codprofe=matricula.codprofe; +------------------+--------------------+ | nombre | nombre | +------------------+--------------------+ | Juan Tobon | Portacio Cartagena | | Federico Aguilar | Portacio Cartagena | +------------------+--------------------+ 2 rows in set (0.001 sec) MariaDB [matricula2]> select max(valorsemestre)'Valor del semestre mas alto' from matricula; +-----------------------------+ | Valor del semestre mas alto | +-----------------------------+ | 3500000 | +-----------------------------+ 1 row in set (0.001 sec) MariaDB [matricula2]> select avg(valorsemestre)'Promedio del Valor semestre ' from matricula; +------------------------------+ | Promedio del Valor semestre | +------------------------------+ | 2558333.3333333335 | +------------------------------+ 1 row in set (0.001 sec) MariaDB [matricula2]> select alumno.nombre from alumno where nombre like 'A%' Or nombre like '%R'; +------------------+ | nombre | +------------------+ | Federico Aguilar | | Angel Cuadrado | | Catalina Escobar | +------------------+ 3 rows in set (0.001 sec) MariaDB [matricula2]> select carrera.carrera,sum(matricula.valorsemestre)'total' from matricula inner join carrera on carrera.codcarre=matricula.codcarre group by carrera.carrera order by carrera.carrera; +----------------------+---------+ | carrera | total | +----------------------+---------+ | Ciencias de la salud | 4750000 | | Derecho | 3600000 | | Veterinaria | 7000000 | +----------------------+---------+ 3 rows in set (0.001 sec) MariaDB [matricula2]> select alumno.nombre from alumno left join matricula on matricula.codestu=alumno.codestu where matricula.codestu is null; +---------------+ | nombre | +---------------+ | Paulina Borja | +---------------+ 1 row in set (0.001 sec) MariaDB [matricula2]>