MariaDB [(none)]> source c:/xampp/matricula2.sql Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.001 sec) Database changed Query OK, 0 rows affected (0.027 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.039 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.001 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 4 rows affected (0.003 sec) Records: 4 Duplicates: 0 Warnings: 0 Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.005 sec) Query OK, 0 rows affected (0.015 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.018 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.002 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 6 rows affected (0.003 sec) Records: 6 Duplicates: 0 Warnings: 0 Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.004 sec) Query OK, 0 rows affected (0.015 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.017 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.001 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 8 rows affected (0.003 sec) Records: 8 Duplicates: 0 Warnings: 0 Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.004 sec) Query OK, 0 rows affected (0.014 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.028 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.001 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 6 rows affected (0.002 sec) Records: 6 Duplicates: 0 Warnings: 0 Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.012 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.031 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.001 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 10 rows affected (0.003 sec) Records: 10 Duplicates: 0 Warnings: 0 Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.004 sec) Query OK, 0 rows affected (0.014 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.017 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.002 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 6 rows affected (0.003 sec) Records: 6 Duplicates: 0 Warnings: 0 Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) MariaDB [matricula2]> use matricula2; Database changed 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.005 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.016 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.000 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.001 sec) MariaDB [matricula2]> select max(valorsemestre)'VALOR MAS ALTO DEL SEMESTRE' from matricula; +-----------------------------+ | VALOR MAS ALTO DEL SEMESTRE | +-----------------------------+ | 3500000 | +-----------------------------+ 1 row in set (0.001 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.000 sec) MariaDB [matricula2]> select * from alumno where nombre like 'A%' or nombre like '%R'; +---------+------------------+-----------+----------+ | codestu | nombre | direccion | telefono | +---------+------------------+-----------+----------+ | 003 | Federico Aguilar | Cra 26 | 4569782 | | 004 | Angel Cuadrado | Cra 44 | 6398521 | | 005 | Catalina Escobar | Cra 78 | 4652300 | +---------+------------------+-----------+----------+ 3 rows in set (0.001 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.001 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.001 sec) MariaDB [matricula2]> exit