MariaDB [matricula2]> show databases; +---------------------+ | Database | +---------------------+ | bd_bibliotecaa | | bdbiblioteca_alexis | | bdinstitucionn | | bdlibreria | | bdlibreriaa | | bdparcialuno | | information_schema | | matricula2 | | mysql | | parc2 | | performance_schema | | phpmyadmin | | test | +---------------------+ 13 rows in set (0.004 sec) MariaDB [matricula2]> use matricula2; Database changed 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.001 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.004 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.003 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.005 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.001 sec) 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.003 sec) MariaDB [matricula2]> select profesor.nombre as 'nombre del profesor', carrera.codcarre as 'codigo carrera', carrera.carrera as 'nombre de la carrera' from profesor join profcar on profesor.codprofe=profcar.codprofe join carrera on carrera.codcarre=profcar.codcarre where carrera.codcarre='001'; +---------------------+----------------+------------------------+ | nombre del profesor | codigo carrera | nombre de la carrera | +---------------------+----------------+------------------------+ | Alberto Cifuentes | 001 | Ingenieria de Sistemas | | Portacio Cartagena | 001 | Ingenieria de Sistemas | +---------------------+----------------+------------------------+ 2 rows in set (0.022 sec) MariaDB [matricula2]> select alumno.nombre, profesor.nombre from alumno join matricula on alumno.codestu = matricula.codestu join carrera on matricula.codcarre = carrera.codcarre join profcar on carrera.codcarre = profcar.codcarre join profesor on profcar.codprofe = profesor.codprofe where carrera.codcarre= '004'; +------------------+----------------------+ | nombre | nombre | +------------------+----------------------+ | Federico Aguilar | Federico Aguilar | | Federico Aguilar | Pablo Juan Gutierrez | | Catalina Escobar | Federico Aguilar | | Catalina Escobar | Pablo Juan Gutierrez | +------------------+----------------------+ 4 rows in set (0.060 sec) MariaDB [matricula2]> select alumno.nombre as 'nombre del alumno', profesor.nombre as 'nombre del profesor', carrera.carrera as 'carrera' from alumno join matricula on alumno.codestu = matricula.codestu join carrera on matricula.codcarre = carrera.codcarre join profcar on carrera.codcarre= profcar.codcarre join profesor on profcar.codprofe = profesor.codprofe where carrera.codcarre='004'; +-------------------+----------------------+---------+ | nombre del alumno | nombre del profesor | carrera | +-------------------+----------------------+---------+ | Federico Aguilar | Federico Aguilar | Derecho | | Federico Aguilar | Pablo Juan Gutierrez | Derecho | | Catalina Escobar | Federico Aguilar | Derecho | | Catalina Escobar | Pablo Juan Gutierrez | Derecho | +-------------------+----------------------+---------+ 4 rows in set (0.002 sec) MariaDB [matricula2]> select alumno.nombre 'nombre del alumno', matricula.valorsemestre 'valor semestre' from matricula join carrera on matricula.codcarre = carrera.codcarre join alumno on matricula.codestu = alumno.codestu where carrera.codcarre= '008'; +-------------------+----------------+ | nombre del alumno | valor semestre | +-------------------+----------------+ | Juan Tobon | 3500000 | | Federico Aguilar | 3500000 | +-------------------+----------------+ 2 rows in set (0.004 sec) MariaDB [matricula2]> select alumno.nombre 'nombre del alumno' from matricula join profcar on matricula.codcarre = profcar.codcarre join profesor on profcar.codprofe = profesor.codprofe join alumno on matricula.codestu = alumno.codestu where profesor.nombre = 'Portacio Cartagena'; +-------------------+ | nombre del alumno | +-------------------+ | Juan Tobon | | Federico Aguilar | +-------------------+ 2 rows in set (0.002 sec) MariaDB [matricula2]> select max(valorsemestre) 'semestre mas alto' from matricula; +-------------------+ | semestre mas alto | +-------------------+ | 3500000 | +-------------------+ 1 row in set (0.006 sec) MariaDB [matricula2]> select avg(valorsemestre) 'promedio del valor del semestre' from matricula; +---------------------------------+ | promedio del valor del semestre | +---------------------------------+ | 2558333.3333333335 | +---------------------------------+ 1 row in set (0.003 sec) MariaDB [matricula2]> select nombre from alumno where nombre like 'A%' or nombre like '%R'; +------------------+ | nombre | +------------------+ | Federico Aguilar | | Angel Cuadrado | | Catalina Escobar | +------------------+ 3 rows in set (0.004 sec) MariaDB [matricula2]> select carrera.carrea, sum(matricula.valorsemestre) 'valor total del semestre' from matricula join carrera on matricula.codcarre = carrera.codcarre group by carrera.carrera; ERROR 1054 (42S22): Unknown column 'carrera.carrea' in 'field list' MariaDB [matricula2]> select carrera.carrera, sum(matricula.valorsemestre) 'valor total del semestre' from matricula join carrera on matricula.codcarre = carrera.codcarre group by carrera.carrera; +----------------------+--------------------------+ | carrera | valor total del semestre | +----------------------+--------------------------+ | Ciencias de la salud | 4750000 | | Derecho | 3600000 | | Veterinaria | 7000000 | +----------------------+--------------------------+ 3 rows in set (0.008 sec) MariaDB [matricula2]> select alumno.nombre 'nombre del alumno' from alumno left join matricula on alumno.codestu = matricula.codestu where matricula.codestu is null; +-------------------+ | nombre del alumno | +-------------------+ | Paulina Borja | +-------------------+ 1 row in set (0.007 sec) MariaDB [matricula2]> exit