Microsoft Windows [Versión 10.0.19045.4291] (c) Microsoft Corporation. Todos los derechos reservados. C:\Users\SebastiánHenao>cd/xampp/mysql/bin C:\xampp\mysql\bin>mysql -uroot -p Enter password: ERROR 2002 (HY000): Can't connect to MySQL server on 'localhost' (10061) C:\xampp\mysql\bin>create database Cursos; "create" no se reconoce como un comando interno o externo, programa o archivo por lotes ejecutable. C:\xampp\mysql\bin>mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 10.4.28-MariaDB mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database Cursos; Query OK, 1 row affected (0.001 sec) MariaDB [(none)]> use Cursos; Database changed MariaDB [Cursos]> create table Estudiante -> (identificacion varchar (10) not null primary key, -> nombre varchar(30) not null, -> estadocivil enum('soltero','casado','union libre','divorciado','viudo') not null, -> fechamatricula date not null); Query OK, 0 rows affected (0.011 sec) MariaDB [Cursos]> insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('2040','Elizabeth Cano', 'casado', '2013-01-01'); Query OK, 1 row affected (0.051 sec) MariaDB [Cursos]> Query OK, 1 row affected (0.012 sec)insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('2140','Denis Rico', 'Divorsiado', '2013-02-18'); 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 'Query OK, 1 row affected (0.012 sec)insert into estudiante (identificacion,no...' at line 1 MariaDB [Cursos]> insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('2140','Denis Rico', 'Divorsiado', '2013-02-18'); Query OK, 1 row affected, 1 warning (0.004 sec) MariaDB [Cursos]> insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('2341','Alfredo Lara', 'casado', '2014-06-20'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('1840','Armando Casas', 'Viudo', '2014-01-28'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('2044','Elihodoro Puerta', 'casado', '2015-07-20'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('2314','Mariana Salinas', 'casado', '2016-06-06'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('2318','Benito Cespedes', 'casado', '2016-06-30'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into estudiante (identificacion,nombre,estadocivil,fechamatricula) values ('2045','Roberto Jimenez', 'soltero', '2017-01-30'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> select distinct fechamatricula 'Año de ingreso', count(*) 'Cantidad de estudiantes ' from estudiante group by year(fechamatricula); +----------------+--------------------------+ | Año de ingreso | Cantidad de estudiantes | +----------------+--------------------------+ | 2013-01-01 | 2 | | 2014-01-28 | 2 | | 2015-07-20 | 1 | | 2016-06-06 | 2 | | 2017-01-30 | 1 | +----------------+--------------------------+ 5 rows in set (0.000 sec) MariaDB [Cursos]> create table registrocursos -> select distinct fechamatricula 'Año de ingreso', count(*) as Cantidaddeestudiantes from estudiante group by year(fechamatricula); Query OK, 5 rows affected (0.021 sec) Records: 5 Duplicates: 0 Warnings: 0 MariaDB [Cursos]> select * from registrocursos; +----------------+-----------------------+ | Año de ingreso | Cantidaddeestudiantes | +----------------+-----------------------+ | 2013-01-01 | 2 | | 2014-01-28 | 2 | | 2015-07-20 | 1 | | 2016-06-06 | 2 | | 2017-01-30 | 1 | +----------------+-----------------------+ 5 rows in set (0.000 sec) MariaDB [Cursos]> show tables; +------------------+ | Tables_in_cursos | +------------------+ | estudiante | | registrocursos | +------------------+ 2 rows in set (0.001 sec) MariaDB [Cursos]> Create table planilla -> (carnet varchar(12) not null primary key, -> nombre varchar (30) not null, -> nota decimal (4,2) unsigned); Query OK, 0 rows affected (0.014 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('010','Soledad Ospina', '4.0'); Query OK, 1 row affected (0.004 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('011','Marta Salazar', '1.5'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('012','Margarita Sol', '1.5'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('013','Fabian Juda', '4.0'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('010','Soledad Ospina', '2.5'); ERROR 1062 (23000): Duplicate entry '010' for key 'PRIMARY' MariaDB [Cursos]> drop table planilla; Query OK, 0 rows affected (0.011 sec) MariaDB [Cursos]> create table planilla -> -> (carnet varchar(12), -> -> nombre varchar(30), -> -> nota decimal(4,2) unsigned); 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 '-> (carnet varchar(12), -> nombre varchar(30), -> nota decimal(4,2) u...' at line 2 MariaDB [Cursos]> ; ERROR: No query specified MariaDB [Cursos]> create table planilla -> (carnet varchar(12), -> nombre varchar(30), -> nota decimal(4,2) unsigned); Query OK, 0 rows affected (0.016 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('010','Soledad Ospina', '4.0'); Query OK, 1 row affected (0.004 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('011','Marta Salazar', '1.5'); Query OK, 1 row affected (0.004 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('012','Margarita Sol', '1.5'); Query OK, 1 row affected (0.002 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('013','Fabian Juda', '4.0'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('010','Soledad Ospina', '2.5'); Query OK, 1 row affected (0.002 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('011','Marta Salazar', '1.0'); Query OK, 1 row affected (0.005 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('012','Margarita Sol', '5.0'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('013','Fabian Juda', '4.5'); Query OK, 1 row affected (0.005 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('010','Soledad Ospina', '2.0'); Query OK, 1 row affected (0.004 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('010','Soledad Ospina ', '3.8'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('011','Marta Salazar', '3.8'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> MariaDB [Cursos]> ; ERROR: No query specified MariaDB [Cursos]> insert into planilla (carnet,nombre,nota) values ('013','Fabian Juda', '5.0'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> select * from planilla; +--------+-----------------+------+ | carnet | nombre | nota | +--------+-----------------+------+ | 010 | Soledad Ospina | 4.00 | | 011 | Marta Salazar | 1.50 | | 012 | Margarita Sol | 1.50 | | 013 | Fabian Juda | 4.00 | | 010 | Soledad Ospina | 2.50 | | 011 | Marta Salazar | 1.00 | | 012 | Margarita Sol | 5.00 | | 013 | Fabian Juda | 4.50 | | 010 | Soledad Ospina | 2.00 | | 010 | Soledad Ospina | 3.80 | | 011 | Marta Salazar | 3.80 | | 013 | Fabian Juda | 5.00 | +--------+-----------------+------+ 12 rows in set (0.000 sec) MariaDB [Cursos]> select distinct carnet as Carnet, sum(nota)/count(*) as promedio from planilla group by carnet; +--------+----------+ | Carnet | promedio | +--------+----------+ | 010 | 3.075000 | | 011 | 2.100000 | | 012 | 3.250000 | | 013 | 4.500000 | +--------+----------+ 4 rows in set (0.000 sec) MariaDB [Cursos]> create table promedio -> select distinct carnet as Carnet, sum(nota)/count(*) as promedio from planilla group by carnet; Query OK, 4 rows affected (0.018 sec) Records: 4 Duplicates: 0 Warnings: 0 MariaDB [Cursos]> select * from promedio; +--------+----------+ | Carnet | promedio | +--------+----------+ | 010 | 3.075000 | | 011 | 2.100000 | | 012 | 3.250000 | | 013 | 4.500000 | +--------+----------+ 4 rows in set (0.000 sec) MariaDB [Cursos]> select p.carnet,pl.nombre,p.promedio from promedio as p join planilla as pl on p.promedio>=4.0 and pl.carnet=p.carnet group by carnet; +--------+-------------+----------+ | carnet | nombre | promedio | +--------+-------------+----------+ | 013 | Fabian Juda | 4.500000 | +--------+-------------+----------+ 1 row in set (0.001 sec) MariaDB [Cursos]> select p.carnet,pl.nombre from promedio as p join planilla as pl on p.promedio>=3.0 and pl.carnet=p.carnet group by carnet; +--------+----------------+ | carnet | nombre | +--------+----------------+ | 010 | Soledad Ospina | | 012 | Margarita Sol | | 013 | Fabian Juda | +--------+----------------+ 3 rows in set (0.000 sec) MariaDB [Cursos]> create table alumno_aprobado -> select p.carnet,pl.nombre from promedio as p join planilla as pl on p.promedio>=3.0 and pl.carnet=p.carnet group by carnet; Query OK, 3 rows affected (0.017 sec) Records: 3 Duplicates: 0 Warnings: 0 MariaDB [Cursos]> select * from alumno_aprobado; +--------+----------------+ | carnet | nombre | +--------+----------------+ | 010 | Soledad Ospina | | 012 | Margarita Sol | | 013 | Fabian Juda | +--------+----------------+ 3 rows in set (0.000 sec) MariaDB [Cursos]> Create table porcentaje_calificacion -> (codpor varchar (5) primary key not null, -> descrip varchar (30) not null); Query OK, 0 rows affected (0.013 sec) MariaDB [Cursos]> insert into porcentaje_calificacion (codpor,descrip) values ('01','Parcial 1'); Query OK, 1 row affected (0.003 sec) MariaDB [Cursos]> insert into porcentaje_calificacion (codpor,descrip) values ('02','Parcial 2'); Query OK, 1 row affected (0.004 sec) MariaDB [Cursos]> insert into porcentaje_calificacion (codpor,descrip) values ('03','Seguimiento'); Query OK, 1 row affected (0.002 sec) MariaDB [Cursos]> insert into porcentaje_calificacion (codpor,descrip) values ('04','Parcial final'); Query OK, 1 row affected (0.002 sec) MariaDB [Cursos]> select pl.carnet, pl.nombre, por.codpor, pr.promedio 'nota_promedio' from planilla as pl join porcentaje_calificacion as por, promedio pr where pl.Carnet=pr.carnet group by pl.Carnet; +--------+----------------+--------+---------------+ | carnet | nombre | codpor | nota_promedio | +--------+----------------+--------+---------------+ | 010 | Soledad Ospina | 01 | 3.075000 | | 011 | Marta Salazar | 01 | 2.100000 | | 012 | Margarita Sol | 01 | 3.250000 | | 013 | Fabian Juda | 01 | 4.500000 | +--------+----------------+--------+---------------+ 4 rows in set (0.001 sec) MariaDB [Cursos]> create table planilla_1 -> select pl.carnet, pl.nombre, por.codpor, pr.promedio 'nota_promedio' from planilla as pl join porcentaje_calificacion as por, promedio pr where pl.Carnet=pr.carnet group by pl.Carnet; Query OK, 4 rows affected (0.016 sec) Records: 4 Duplicates: 0 Warnings: 0 MariaDB [Cursos]> select * from planilla_1; +--------+----------------+--------+---------------+ | carnet | nombre | codpor | nota_promedio | +--------+----------------+--------+---------------+ | 010 | Soledad Ospina | 01 | 3.075000 | | 011 | Marta Salazar | 01 | 2.100000 | | 012 | Margarita Sol | 01 | 3.250000 | | 013 | Fabian Juda | 01 | 4.500000 | +--------+----------------+--------+---------------+ 4 rows in set (0.000 sec) MariaDB [Cursos]> describe planilla_1; +---------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+---------------+------+-----+---------+-------+ | carnet | varchar(12) | YES | | NULL | | | nombre | varchar(30) | YES | | NULL | | | codpor | varchar(5) | NO | | NULL | | | nota_promedio | decimal(30,6) | YES | | NULL | | +---------------+---------------+------+-----+---------+-------+ 4 rows in set (0.014 sec) MariaDB [Cursos]> insert into planilla_1 (carnet,nombre,codpor,nota_promedio) -> select '05','Edilberto Parra',codpor,3.8 -> from porcentaje_calificacion -> where codpor='01'; Query OK, 1 row affected (0.003 sec) Records: 1 Duplicates: 0 Warnings: 0 MariaDB [Cursos]> select * from planilla_1; +--------+-----------------+--------+---------------+ | carnet | nombre | codpor | nota_promedio | +--------+-----------------+--------+---------------+ | 010 | Soledad Ospina | 01 | 3.075000 | | 011 | Marta Salazar | 01 | 2.100000 | | 012 | Margarita Sol | 01 | 3.250000 | | 013 | Fabian Juda | 01 | 4.500000 | | 05 | Edilberto Parra | 01 | 3.800000 | +--------+-----------------+--------+---------------+ 5 rows in set (0.000 sec) MariaDB [Cursos]> select * from planilla; +--------+-----------------+------+ | carnet | nombre | nota | +--------+-----------------+------+ | 010 | Soledad Ospina | 4.00 | | 011 | Marta Salazar | 1.50 | | 012 | Margarita Sol | 1.50 | | 013 | Fabian Juda | 4.00 | | 010 | Soledad Ospina | 2.50 | | 011 | Marta Salazar | 1.00 | | 012 | Margarita Sol | 5.00 | | 013 | Fabian Juda | 4.50 | | 010 | Soledad Ospina | 2.00 | | 010 | Soledad Ospina | 3.80 | | 011 | Marta Salazar | 3.80 | | 013 | Fabian Juda | 5.00 | +--------+-----------------+------+ 12 rows in set (0.000 sec) MariaDB [Cursos]> exit Bye C:\xampp\mysql\bin>mysqldump -b -uroot -p Cursos>c:/xampp/parcial2.sql mysqldump: unknown option '-b' C:\xampp\mysql\bin>mysqldump -u root -p Cursos > parcial2sebashenao.sql Enter password: