Microsoft Windows [Versión 10.0.22621.1702] (c) Microsoft Corporation. Todos los derechos reservados. Z:\>cd/xampp/mysql/bin El sistema no puede encontrar la ruta especificada. Z:\>cd/xampp/mysql/bin El sistema no puede encontrar la ruta especificada. Z:\>C: C:\>cd/xampp/mysql/bin 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.21-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)]> use cumple; ERROR 1049 (42000): Unknown database 'cumple' MariaDB [(none)]> show database; 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 'database' at line 1 MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | phpmyadmin | | test | +--------------------+ 5 rows in set (0.011 sec) MariaDB [(none)]> use cumple; ERROR 1049 (42000): Unknown database 'cumple' MariaDB [(none)]> show database; 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 'database' at line 1 MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | phpmyadmin | | test | +--------------------+ 5 rows in set (0.000 sec) MariaDB [(none)]> use Cumple; ERROR 1049 (42000): Unknown database 'cumple' MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | phpmyadmin | | test | +--------------------+ 5 rows in set (0.001 sec) MariaDB [(none)]> source C:\xampp\cumple.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, 1 row affected (0.001 sec) Database changed Query OK, 0 rows affected (0.073 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.174 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.021 sec) Records: 8 Duplicates: 0 Warnings: 0 Query OK, 0 rows affected (0.000 sec) Query OK, 0 rows affected (0.046 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 [cumple]> show tables; +------------------+ | Tables_in_cumple | +------------------+ | ejercicio | +------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> describe ejercicio; +------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+----------+------+-----+---------+-------+ | codigo | char(10) | NO | PRI | NULL | | | nombre | char(30) | YES | | NULL | | | sexo | char(10) | YES | | NULL | | | nacimiento | date | YES | | NULL | | | hijos | char(2) | YES | | NULL | | +------------+----------+------+-----+---------+-------+ 5 rows in set (0.013 sec) MariaDB [cumple]> select * from ejercicio; +------------+-------------------+--------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+-------------------+--------+------------+-------+ | 0022559966 | Eder Pulgar | Hombre | 1960-02-20 | 6 | | 0028957446 | Juan Carlos Serpa | Hombre | 1982-11-25 | 2 | | 0822559966 | Mariana Gonzalez | Mujer | 1982-03-24 | 1 | | 1188996633 | Yoreida Maria | Mujer | 1978-03-05 | 2 | | 22663355 | Angel Cuadrado | hombre | 1966-05-13 | 0 | | 4488663322 | Jorge Fuentes | Hombre | 1980-06-22 | 2 | | 556959966 | Angela Ruiz | Mujer | 1977-11-15 | 1 | | 9999957446 | Carlota Sonora | Mujer | 1985-11-03 | 4 | +------------+-------------------+--------+------------+-------+ 8 rows in set (0.000 sec) MariaDB [cumple]> select current_date(); +----------------+ | current_date() | +----------------+ | 2023-08-12 | +----------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select current_date(); +----------------+ | current_date() | +----------------+ | 2023-08-12 | +----------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select month(current_date(); 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 '' at line 1 MariaDB [cumple]> select month(current_date()); +-----------------------+ | month(current_date()) | +-----------------------+ | 8 | +-----------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select day(current_date()); +---------------------+ | day(current_date()) | +---------------------+ | 12 | +---------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select date_add(current_date(),interval 6 year); +------------------------------------------+ | date_add(current_date(),interval 6 year) | +------------------------------------------+ | 2029-08-12 | +------------------------------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select date_format(now(),'%h:%i:%s %p'); +----------------------------------+ | date_format(now(),'%h:%i:%s %p') | +----------------------------------+ | 04:32:27 PM | +----------------------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select datediff(current_date(),'1995-02-06'); +---------------------------------------+ | datediff(current_date(),'1995-02-06') | +---------------------------------------+ | 10414 | +---------------------------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select nombre, year(current_date()) - year(1995) from ejercicio; +-------------------+-----------------------------------+ | nombre | year(current_date()) - year(1995) | +-------------------+-----------------------------------+ | Eder Pulgar | NULL | | Juan Carlos Serpa | NULL | | Mariana Gonzalez | NULL | | Yoreida Maria | NULL | | Angel Cuadrado | NULL | | Jorge Fuentes | NULL | | Angela Ruiz | NULL | | Carlota Sonora | NULL | +-------------------+-----------------------------------+ 8 rows in set, 8 warnings (0.000 sec) MariaDB [cumple]> select nombre, year(current_date()) - year(nacimiento) from ejercicio; +-------------------+-----------------------------------------+ | nombre | year(current_date()) - year(nacimiento) | +-------------------+-----------------------------------------+ | Eder Pulgar | 63 | | Juan Carlos Serpa | 41 | | Mariana Gonzalez | 41 | | Yoreida Maria | 45 | | Angel Cuadrado | 57 | | Jorge Fuentes | 43 | | Angela Ruiz | 46 | | Carlota Sonora | 38 | +-------------------+-----------------------------------------+ 8 rows in set (0.000 sec) MariaDB [cumple]> select nombre, year(current_date()) - year(1995-02-06); ERROR 1054 (42S22): Unknown column 'nombre' in 'field list' MariaDB [cumple]> select year(current_date()) - year(1995-02-06); +-----------------------------------------+ | year(current_date()) - year(1995-02-06) | +-----------------------------------------+ | NULL | +-----------------------------------------+ 1 row in set, 1 warning (0.000 sec) MariaDB [cumple]> select year(current_date()) - year(1995); +-----------------------------------+ | year(current_date()) - year(1995) | +-----------------------------------+ | NULL | +-----------------------------------+ 1 row in set, 1 warning (0.000 sec) MariaDB [cumple]> select year(current_date()) - year('1995'); +-------------------------------------+ | year(current_date()) - year('1995') | +-------------------------------------+ | NULL | +-------------------------------------+ 1 row in set, 1 warning (0.000 sec) MariaDB [cumple]> select year(current_date()) - year('1995-02-06'); +-------------------------------------------+ | year(current_date()) - year('1995-02-06') | +-------------------------------------------+ | 28 | +-------------------------------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select nombre from ejercicio where sexo='mujer' and nombre like '%a'; +----------------+ | nombre | +----------------+ | Yoreida Maria | | Carlota Sonora | +----------------+ 2 rows in set (0.000 sec) MariaDB [cumple]> select count(*) from ejercicio where sexo='mujer' and nombre like '%a'; +----------+ | count(*) | +----------+ | 2 | +----------+ 1 row in set (0.000 sec) MariaDB [cumple]> select * from ejercicio; +------------+-------------------+--------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+-------------------+--------+------------+-------+ | 0022559966 | Eder Pulgar | Hombre | 1960-02-20 | 6 | | 0028957446 | Juan Carlos Serpa | Hombre | 1982-11-25 | 2 | | 0822559966 | Mariana Gonzalez | Mujer | 1982-03-24 | 1 | | 1188996633 | Yoreida Maria | Mujer | 1978-03-05 | 2 | | 22663355 | Angel Cuadrado | hombre | 1966-05-13 | 0 | | 4488663322 | Jorge Fuentes | Hombre | 1980-06-22 | 2 | | 556959966 | Angela Ruiz | Mujer | 1977-11-15 | 1 | | 9999957446 | Carlota Sonora | Mujer | 1985-11-03 | 4 | +------------+-------------------+--------+------------+-------+ 8 rows in set (0.000 sec) MariaDB [cumple]> select count(*) from ejercicio where year(nacimiento) between '1960'and 1969; +----------+ | count(*) | +----------+ | 2 | +----------+ 1 row in set (0.000 sec) MariaDB [cumple]> select * from ejercicio where year(current_date()) - year(nacimiento) between '34' and '37'; Empty set (0.000 sec) MariaDB [cumple]> select nombre(*) from ejercicio where year(nacimiento) between '1960'and 1969; 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 '*) from ejercicio where year(nacimiento) between '1960'and 1969' at line 1 MariaDB [cumple]> select nombre from ejercicio where year(nacimiento) between '1960'and 1969; +----------------+ | nombre | +----------------+ | Eder Pulgar | | Angel Cuadrado | +----------------+ 2 rows in set (0.000 sec) MariaDB [cumple]> select * from ejercicio where year(current_date()) - year(nacimiento) between '38' and '41'; +------------+-------------------+--------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+-------------------+--------+------------+-------+ | 0028957446 | Juan Carlos Serpa | Hombre | 1982-11-25 | 2 | | 0822559966 | Mariana Gonzalez | Mujer | 1982-03-24 | 1 | | 9999957446 | Carlota Sonora | Mujer | 1985-11-03 | 4 | +------------+-------------------+--------+------------+-------+ 3 rows in set (0.000 sec) MariaDB [cumple]> select sum(hijos) from ejercicio; +------------+ | sum(hijos) | +------------+ | 18 | +------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select hijos,count(*) from ejercicio group by hijos; +-------+----------+ | hijos | count(*) | +-------+----------+ | 0 | 1 | | 1 | 2 | | 2 | 3 | | 4 | 1 | | 6 | 1 | +-------+----------+ 5 rows in set (0.001 sec) MariaDB [cumple]> select count(*) from ejercicio where year(current_date)-year(nacimiento)<=37 and sexo='mujer'; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set (0.000 sec) MariaDB [cumple]> select count(*) from ejercicio where year(current_date)-year(nacimiento)<=41 and sexo='mujer'; +----------+ | count(*) | +----------+ | 2 | +----------+ 1 row in set (0.000 sec) MariaDB [cumple]> select * from ejercicio where year(current_date)-year(nacimiento)<=41 and sexo='mujer'; +------------+------------------+-------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+------------------+-------+------------+-------+ | 0822559966 | Mariana Gonzalez | Mujer | 1982-03-24 | 1 | | 9999957446 | Carlota Sonora | Mujer | 1985-11-03 | 4 | +------------+------------------+-------+------------+-------+ 2 rows in set (0.000 sec) MariaDB [cumple]> create view ejercicioa as select * from ejercicio where nombre like'%a'; Query OK, 0 rows affected (0.015 sec) MariaDB [cumple]> show tables; +------------------+ | Tables_in_cumple | +------------------+ | ejercicio | | ejercicioa | +------------------+ 2 rows in set (0.000 sec) MariaDB [cumple]> select * from ejercicioa; +------------+-------------------+--------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+-------------------+--------+------------+-------+ | 0028957446 | Juan Carlos Serpa | Hombre | 1982-11-25 | 2 | | 1188996633 | Yoreida Maria | Mujer | 1978-03-05 | 2 | | 9999957446 | Carlota Sonora | Mujer | 1985-11-03 | 4 | +------------+-------------------+--------+------------+-------+ 3 rows in set (0.001 sec) MariaDB [cumple]> create view ejerciciosexo as select * from ejercicio where sexo= "hombre"; Query OK, 0 rows affected (0.022 sec) MariaDB [cumple]> show tables; +------------------+ | Tables_in_cumple | +------------------+ | ejercicio | | ejercicioa | | ejerciciosexo | +------------------+ 3 rows in set (0.000 sec) MariaDB [cumple]> select * from ejerciciosexo; +------------+-------------------+--------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+-------------------+--------+------------+-------+ | 0022559966 | Eder Pulgar | Hombre | 1960-02-20 | 6 | | 0028957446 | Juan Carlos Serpa | Hombre | 1982-11-25 | 2 | | 22663355 | Angel Cuadrado | hombre | 1966-05-13 | 0 | | 4488663322 | Jorge Fuentes | Hombre | 1980-06-22 | 2 | +------------+-------------------+--------+------------+-------+ 4 rows in set (0.001 sec) MariaDB [cumple]> insert into ejercicio(codigo,nombre,sexo,nacimiento,hijos) values('8005129','Alberto Lechona','hombre','1970-03-22','1'); Query OK, 1 row affected (0.048 sec) MariaDB [cumple]> select * from ejercicio; +------------+-------------------+--------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+-------------------+--------+------------+-------+ | 0022559966 | Eder Pulgar | Hombre | 1960-02-20 | 6 | | 0028957446 | Juan Carlos Serpa | Hombre | 1982-11-25 | 2 | | 0822559966 | Mariana Gonzalez | Mujer | 1982-03-24 | 1 | | 1188996633 | Yoreida Maria | Mujer | 1978-03-05 | 2 | | 22663355 | Angel Cuadrado | hombre | 1966-05-13 | 0 | | 4488663322 | Jorge Fuentes | Hombre | 1980-06-22 | 2 | | 556959966 | Angela Ruiz | Mujer | 1977-11-15 | 1 | | 8005129 | Alberto Lechona | hombre | 1970-03-22 | 1 | | 9999957446 | Carlota Sonora | Mujer | 1985-11-03 | 4 | +------------+-------------------+--------+------------+-------+ 9 rows in set (0.000 sec) MariaDB [cumple]> select * from ejercicioa; +------------+-------------------+--------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+-------------------+--------+------------+-------+ | 0028957446 | Juan Carlos Serpa | Hombre | 1982-11-25 | 2 | | 1188996633 | Yoreida Maria | Mujer | 1978-03-05 | 2 | | 8005129 | Alberto Lechona | hombre | 1970-03-22 | 1 | | 9999957446 | Carlota Sonora | Mujer | 1985-11-03 | 4 | +------------+-------------------+--------+------------+-------+ 4 rows in set (0.000 sec) MariaDB [cumple]> drop view nombredelavistaaeliminar; ERROR 4092 (42S02): Unknown VIEW: 'cumple.nombredelavistaaeliminar' MariaDB [cumple]> drop view ejercicioa; Query OK, 0 rows affected (0.001 sec) MariaDB [cumple]> show tables; +------------------+ | Tables_in_cumple | +------------------+ | ejercicio | | ejerciciosexo | +------------------+ 2 rows in set (0.000 sec) MariaDB [cumple]>