MariaDB [(none)]> source C:\Users\admin\Desktop\matricula2.sql Query OK, 0 rows affected (0.002 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) 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, 1 row affected (0.002 sec) Database changed Query OK, 0 rows affected (0.034 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.001 sec) Query OK, 4 rows affected (0.001 sec) Records: 4 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.019 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.003 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 6 rows affected (0.001 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.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, 8 rows affected (0.002 sec) Records: 8 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.020 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.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.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.019 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, 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.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.017 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.003 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 6 rows affected (0.001 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]> show tables; +----------------------+ | Tables_in_matricula2 | +----------------------+ | alumcar | | alumno | | carrera | | matricula | | profcar | | profesor | +----------------------+ 6 rows in set (0.002 sec) MariaDB [matricula2]> select * alumno; 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 'alumno' at line 1 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.003 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.002 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.002 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 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.002 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]> describe matricula; +---------------+-----------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+-----------------+------+-----+---------+-------+ | codmatri | char(3) | NO | PRI | NULL | | | codestu | char(3) | NO | MUL | NULL | | | codcarre | char(3) | NO | | NULL | | | codprofe | char(3) | NO | | NULL | | | valorsemestre | double unsigned | NO | | NULL | | +---------------+-----------------+------+-----+---------+-------+ 5 rows in set (0.010 sec) MariaDB [matricula2]> select profesor.nombre as 'Nombre Profesor' from profesor inner join profcar on profesor.codprof = profcar.codprofe where profcar.codcarre='001'; ERROR 1054 (42S22): Unknown column 'profesor.codprof' in 'on clause' MariaDB [matricula2]> select profesor.nombre as 'Nombre Profesor' from profesor inner join profcar on profesor.codprofe = profcar.codprofe where profcar.codcarre='001'; +--------------------+ | Nombre Profesor | +--------------------+ | Alberto Cifuentes | | Portacio Cartagena | +--------------------+ 2 rows in set (0.002 sec) MariaDB [matricula2]> select profesor.nombre as 'Nombre Profesor' from profesor inner join profcar on profesor.codprofe = profcar.codprofe where profcar.codcarre='001' into outflie 'c:/xampp/ProfesoresIngenieriaSistemas.xls' ; ERROR 1327 (42000): Undeclared variable: outflie MariaDB [matricula2]> select profesor.nombre as 'Nombre Profesor' from profesor inner join profcar on profesor.codprofe = profcar.codprofe where profcar.codcarre='001' into outfile 'c:/xampp/ProfesoresIngenieriaSistemas.xls' ; Query OK, 2 rows affected, 1 warning (0.002 sec) MariaDB [matricula2]> select profesor.nombre as 'Docentes Derecho' from profcar inner join profesor profcar.codprofe=profesor.codprofe where profcar.codcarre = '004'; ERROR 1066 (42000): Not unique table/alias: 'profcar' MariaDB [matricula2]> select profesor.nombre as 'Docentes Derecho' from profcar inner join profesor on profcar.codprofe=profesor.codprofe where profcar.codcarre = '004'; +----------------------+ | Docentes Derecho | +----------------------+ | Federico Aguilar | | Pablo Juan Gutierrez | +----------------------+ 2 rows in set (0.000 sec) MariaDB [matricula2]> select profesor.nombre as 'Docentes Derecho' from profcar inner join profesor on profcar.codprofe=profesor.codprofe where profcar.codcarre = '004' into outfile 'c:/xampp/DocentesDerecho.xls'; Query OK, 2 rows affected, 1 warning (0.023 sec) MariaDB [matricula2]> select matricula.valorsemestre from matricula where codcarre='008'; +---------------+ | valorsemestre | +---------------+ | 3500000 | | 3500000 | +---------------+ 2 rows in set (0.000 sec) MariaDB [matricula2]> select distinct matricula.valorsemestre from matricula where codcarre='008'; +---------------+ | valorsemestre | +---------------+ | 3500000 | +---------------+ 1 row in set (0.000 sec) MariaDB [matricula2]> select distinct matricula.valorsemestre from matricula where codcarre='008' into outfile 'c:/xampp/CostoVeterinaria'; Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos' profesor.nombre as 'Docente' from alumno inner join matricula on alumno.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where profesor.codprofe='003'; 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 'profesor.nombre as 'Docente' from alumno inner join matricula on alumno.codes...' at line 1 MariaDB [matricula2]> select alumno.nombre as 'Alumnos', profesor.nombre as 'Docente' from alumno inner join matricula on alumno.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where profesor.codprofe='003'; +------------------+--------------------+ | Alumnos | Docente | +------------------+--------------------+ | Juan Tobon | Portacio Cartagena | | Federico Aguilar | Portacio Cartagena | +------------------+--------------------+ 2 rows in set (0.000 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos', profesor.nombre as 'Docente' from alumno inner join matricula on alumno.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where profesor.codprofe='003' into outfile 'c:/xampp/AlumnosdePortacio'; Query OK, 2 rows affected, 1 warning (0.002 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos', profesor.nombre as 'Docente' from alumno inner join matricula on alumno.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where profesor.codprofe='003' into outfile 'c:/xampp/AlumnosdePortacio.xls'; Query OK, 2 rows affected, 1 warning (0.001 sec) MariaDB [matricula2]> select distinct matricula.valorsemestre from matricula where codcarre='008' into outfile 'c:/xampp/CostoVeterinaria.xls'; Query OK, 1 row affected, 1 warning (0.001 sec) MariaDB [matricula2]> select max(valorsemestre) from matricula; +--------------------+ | max(valorsemestre) | +--------------------+ | 3500000 | +--------------------+ 1 row in set (0.002 sec) MariaDB [matricula2]> select max(valorsemestre) from matricula into outfile 'c:/xampp/ValorMasAltoSemestre.xls'; Query OK, 1 row affected, 1 warning (0.001 sec) MariaDB [matricula2]> select avg(valorsemestre) from matricula; +--------------------+ | avg(valorsemestre) | +--------------------+ | 2558333.3333333335 | +--------------------+ 1 row in set (0.001 sec) MariaDB [matricula2]> select avg(valorsemestre) as 'Valor promedio' from matricula; +--------------------+ | Valor promedio | +--------------------+ | 2558333.3333333335 | +--------------------+ 1 row in set (0.000 sec) MariaDB [matricula2]> select avg(valorsemestre) as 'Valor promedio' from matricula into outfile 'c:/xampp/PromedioValorSemestre'; Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [matricula2]> select alumno.nombre form alumno where alumno.nombre like a% or alumno.nombre %r; 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 'alumno where alumno.nombre like 'a%' or alumno.nombre like '%r'' at line 1 MariaDB [matricula2]> select alumno.nombre from alumno where alumno.nombre like 'a%' or alumno.nombre like '%r'; +------------------+ | nombre | +------------------+ | Federico Aguilar | | Angel Cuadrado | | Catalina Escobar | +------------------+ 3 rows in set (0.000 sec) MariaDB [matricula2]> select alumno.nombre AS 'Alumnos' from alumno where alumno.nombre like 'a%' or alumno.nombre like '%r'; +------------------+ | Alumnos | +------------------+ | Federico Aguilar | | Angel Cuadrado | | Catalina Escobar | +------------------+ 3 rows in set (0.000 sec) MariaDB [matricula2]> select avg(valorsemestre) as 'Valor promedio' from matricula into outfile 'c:/xampp/PromedioValorSemestre.xls'; Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [matricula2]> select alumno.nombre AS 'Alumnos' from alumno where alumno.nombre like 'a%' or alumno.nombre like '%r' into outfile 'c:/xampp/NombreEstudiantesA_R.xls'; Query OK, 3 rows affected, 1 warning (0.001 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos' from alumno left join matricula on alumno.codestu=matricula.codestu where matricula.codestu=null; Empty set (0.000 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos' from alumno left join matricula on alumno.codestu=matricula.codestu; +------------------+ | Alumnos | +------------------+ | Juan Tobon | | Mario Gonzales | | Federico Aguilar | | Federico Aguilar | | Angel Cuadrado | | Catalina Escobar | | Paulina Borja | +------------------+ 7 rows in set (0.000 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos' from alumno left join matricula on alumno.codestu=matricula.codestu where matricula.codestu=null; Empty set (0.000 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos' from alumno left join matricula on alumno.codestu=matricula.codestu where matricula.codestu is null; +---------------+ | Alumnos | +---------------+ | Paulina Borja | +---------------+ 1 row in set (0.001 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos' from alumno left join matricula on alumno.codestu=matricula.codestu where matricula.codestu is null into outfile 'c:/xampp/AlumnosSinMatricula.xls'; Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [matricula2]> select sum(valorsemestre) as 'Valor Total' from matricula; +-------------+ | Valor Total | +-------------+ | 15350000 | +-------------+ 1 row in set (0.000 sec) MariaDB [matricula2]> select sum(valorsemestre) as 'Valor Total' from matricula into outfile 'c:/xampp/TotalPagadoCarreras'; Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [matricula2]> select sum(valorsemestre) as 'Valor Total Derecho' from matricula where matricula.codcarre='004'; +---------------------+ | Valor Total Derecho | +---------------------+ | 3600000 | +---------------------+ 1 row in set (0.000 sec) MariaDB [matricula2]> select sum(valorsemestre) as 'Valor Total Derecho' from matricula where matricula.codcarre='004' into outfile'c:/xampp/TotalDerecho'; Query OK, 1 row affected, 1 warning (0.001 sec) MariaDB [matricula2]> select sum(valorsemestre) as 'Valor Total Veterinatia' from matricula where matricula.codcarre='008' into outfile'c:/xampp/TotalVeterinaria'; Query OK, 1 row affected, 1 warning (0.001 sec) MariaDB [matricula2]> select sum(valorsemestre) from matricula where matricula.codcarre='007' into outfile'c:/xampp/TotalCienciasSalud'; Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos', profesor.nombre as 'Docentes' from alumnos inner join matricula on alumcar.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where matricula.codcarre='004' -> ; ERROR 1146 (42S02): Table 'matricula2.alumnos' doesn't exist MariaDB [matricula2]> select alumno.nombre as 'Alumnos', profesor.nombre as 'Docentes' from alumno inner join matricula on alumcar.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where matricula.codcarre='004'; ERROR 1054 (42S22): Unknown column 'alumcar.codestu' in 'on clause' MariaDB [matricula2]> select alumno.nombre as 'Alumnos', profesor.nombre as 'Docentes' from alumno inner join matricula on alumno.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where matricula.codcarre='004'; +------------------+----------------------+ | Alumnos | Docentes | +------------------+----------------------+ | Federico Aguilar | Federico Aguilar | | Catalina Escobar | Pablo Juan Gutierrez | +------------------+----------------------+ 2 rows in set (0.000 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos', profesor.nombre as 'Docentes' from alumno inner join matricula on alumno.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where matricula.codcarre='004' into outfile'c:/xampp/matriculadosDerecho'; Query OK, 2 rows affected, 1 warning (0.002 sec) MariaDB [matricula2]> select alumno.nombre as 'Alumnos', profesor.nombre as 'Docentes' from alumno inner join matricula on alumno.codestu=matricula.codestu inner join profesor on matricula.codprofe=profesor.codprofe where matricula.codcarre='004' into outfile'c:/xampp/matriculadosDerecho.xls'; Query OK, 2 rows affected, 1 warning (0.001 sec) MariaDB [matricula2]> select sum(valorsemestre) as 'Valor Total' from matricula into outfile 'c:/xampp/TotalPagadoCarreras.xls'; Query OK, 1 row affected, 1 warning (0.001 sec) MariaDB [matricula2]> select sum(valorsemestre) as 'Valor Total Derecho' from matricula where matricula.codcarre='004' into outfile'c:/xampp/TotalDerecho.xls'; Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [matricula2]> select sum(valorsemestre) as 'Valor Total Veterinatia' from matricula where matricula.codcarre='008' into outfile'c:/xampp/TotalVeterinaria.xls'; Query OK, 1 row affected, 1 warning (0.001 sec) MariaDB [matricula2]> select sum(valorsemestre) from matricula where matricula.codcarre='007' into outfile'c:/xampp/TotalCienciasSalud.xls'; Query OK, 1 row affected, 1 warning (0.002 sec) MariaDB [matricula2]> exit