MariaDB [matricula2]> show tables; +----------------------+ | Tables_in_matricula2 | +----------------------+ | alumcar | | alumno | | carrera | | matricula | | profcar | | profesor | +----------------------+ 6 rows in set (0.00 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.00 sec) MariaDB [matricula2]> select * from alumcar; +---------+----------+ | codestu | codcarre | +---------+----------+ | 001 | 002 | | 003 | 005 | | 005 | 001 | | 001 | 005 | +---------+----------+ 4 rows in set (0.00 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.00 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.01 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.00 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.04 sec) MariaDB [matricula2]> select carrera.carrera 'CARRERA', profesor.codprofe 'CODIGO',profesor.nombre 'PROFESOR' from profesor, carrera, profcar where profesor.codprofe=profcar.codprofe and profcar.codcarre=carrera.codcarre and carrera.codcarre='001'; +------------------------+--------+--------------------+ | CARRERA | CODIGO | PROFESOR | +------------------------+--------+--------------------+ | Ingenieria de Sistemas | 005 | Alberto Cifuentes | | Ingenieria de Sistemas | 003 | Portacio Cartagena | +------------------------+--------+--------------------+ 2 rows in set (0.01 sec) MariaDB [matricula2]> select alumno.nombre 'ALUMNO', carrera.carrera 'CARRERA', profesor.nombre 'PROFESOR' from alumno, profesor, carrera, matricula where alumno.codestu=matricula.codestu and carrera.codcarre=matricula.codcarre and matricula.codprofe=profesor.codprofe and matricula.codcarre='004'; +------------------+---------+----------------------+ | ALUMNO | CARRERA | PROFESOR | +------------------+---------+----------------------+ | Federico Aguilar | Derecho | Federico Aguilar | | Catalina Escobar | Derecho | Pablo Juan Gutierrez | +------------------+---------+----------------------+ 2 rows in set (0.00 sec) MariaDB [matricula2]> select carrera.carrera 'CARRERA', matricula.valorsemestre 'VALOR SEMESTRE' from carrera,matricula where carrera.codcarre=matricula.codcarre and matricula.codcarre='008'; +-------------+----------------+ | CARRERA | VALOR SEMESTRE | +-------------+----------------+ | Veterinaria | 3500000 | | Veterinaria | 3500000 | +-------------+----------------+ 2 rows in set (0.00 sec) MariaDB [matricula2]> select distinct carrera.carrera 'CARRERA', matricula.valorsemestre 'VALOR SEMESTRE' from carrera,matricula where carrera.codcarre=matricula.codcarre and matricula.codcarre='008'; +-------------+----------------+ | CARRERA | VALOR SEMESTRE | +-------------+----------------+ | Veterinaria | 3500000 | +-------------+----------------+ 1 row in set (0.01 sec) MariaDB [matricula2]> select * from alumno,matricula,profesor where alumno.codestu=matricula.codestu and matricula.codprofe=profesor.codprofe and matricula.codprofe='003'; +---------+------------------+-----------+----------+----------+---------+----------+----------+---------------+----------+--------------------+-----------+----------+ | codestu | nombre | direccion | telefono | codmatri | codestu | codcarre | codprofe | valorsemestre | codprofe | nombre | direccion | telefono | +---------+------------------+-----------+----------+----------+---------+----------+----------+---------------+----------+--------------------+-----------+----------+ | 001 | Juan Tobon | Cra 59 | 2335698 | 002 | 001 | 008 | 003 | 3500000 | 003 | Portacio Cartagena | cra 36-01 | 4596321 | | 003 | Federico Aguilar | Cra 26 | 4569782 | 006 | 003 | 008 | 003 | 3500000 | 003 | Portacio Cartagena | cra 36-01 | 4596321 | +---------+------------------+-----------+----------+----------+---------+----------+----------+---------------+----------+--------------------+-----------+----------+ 2 rows in set (0.00 sec) MariaDB [matricula2]> select * from alumno,matricula,profesor where alumno.codestu=matricula.codestu and matricula.codprofe=profesor.codprofe and matricula.codprofe='003'; +---------+------------------+-----------+----------+----------+---------+----------+----------+---------------+----------+--------------------+-----------+----------+ | codestu | nombre | direccion | telefono | codmatri | codestu | codcarre | codprofe | valorsemestre | codprofe | nombre | direccion | telefono | +---------+------------------+-----------+----------+----------+---------+----------+----------+---------------+----------+--------------------+-----------+----------+ | 001 | Juan Tobon | Cra 59 | 2335698 | 002 | 001 | 008 | 003 | 3500000 | 003 | Portacio Cartagena | cra 36-01 | 4596321 | | 003 | Federico Aguilar | Cra 26 | 4569782 | 006 | 003 | 008 | 003 | 3500000 | 003 | Portacio Cartagena | cra 36-01 | 4596321 | +---------+------------------+-----------+----------+----------+---------+----------+----------+---------------+----------+--------------------+-----------+----------+ 2 rows in set (0.00 sec) MariaDB [matricula2]> select max(valorsemestre)'VALOR MAS ALTO DEL SEMESTRE' from matricula; +-----------------------------+ | VALOR MAS ALTO DEL SEMESTRE | +-----------------------------+ | 3500000 | +-----------------------------+ 1 row in set (0.00 sec) MariaDB [matricula2]> select avg(valorsemestre)'PROMEDIO DE VALOR DEL SEMESTRE' from matricula; +--------------------------------+ | PROMEDIO DE VALOR DEL SEMESTRE | +--------------------------------+ | 2558333.3333333335 | +--------------------------------+ 1 row in set (0.00 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.00 sec) (ensayooo) MariaDB [matricula2]> select carrera.carrera, sum(valorsemestre) 'VALOR PAGADOD POR CARRERA' from matricula, carrera group by matricula.codcarre; +------------------------+---------------------------+ | carrera | VALOR PAGADOD POR CARRERA | +------------------------+---------------------------+ | Ingenieria de Sistemas | 28800000 | | Ingenieria de Sistemas | 38000000 | | Ingenieria de Sistemas | 56000000 | +------------------------+---------------------------+ 3 rows in set (0.02 sec) MariaDB [matricula2]> select carrera.carrera 'CARRERA', sum(valorsemestre) 'VALOR PAGADOD POR CARRERA' from matricula, carrera where carrera.codcarre=matricula.codcarre group by matricula.codcarre; +----------------------+---------------------------+ | CARRERA | VALOR PAGADOD POR CARRERA | +----------------------+---------------------------+ | Derecho | 3600000 | | Ciencias de la salud | 4750000 | | Veterinaria | 7000000 | +----------------------+---------------------------+ 3 rows in set (0.00 sec) MariaDB [matricula2]> select * from alumno left join matricula on alumno.codestu=matricula.codestu where matricula.codestu is null; +---------+---------------+-----------+----------+----------+---------+----------+----------+---------------+ | codestu | nombre | direccion | telefono | codmatri | codestu | codcarre | codprofe | valorsemestre | +---------+---------------+-----------+----------+----------+---------+----------+----------+---------------+ | 006 | Paulina Borja | Cra 45 | 4599632 | NULL | NULL | NULL | NULL | NULL | +---------+---------------+-----------+----------+----------+---------+----------+----------+---------------+ 1 row in set (0.01 sec) MariaDB [matricula2]> exit