MariaDB [cumple]> show tables; +------------------+ | Tables_in_cumple | +------------------+ | ejercicio | +------------------+ 1 row in set (0.001 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.024 sec) MariaDB [cumple]> select current_date(); +----------------+ | current_date() | +----------------+ | 2024-02-25 | +----------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select year (current_date()); +-----------------------+ | year (current_date()) | +-----------------------+ | 2024 | +-----------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select month (current_date()); +------------------------+ | month (current_date()) | +------------------------+ | 2 | +------------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select day (currentn_date()); ERROR 1305 (42000): FUNCTION cumple.currentn_date does not exist MariaDB [cumple]> select day (current_date()); +----------------------+ | day (current_date()) | +----------------------+ | 25 | +----------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select date_add (current_date(),interval 6 year); 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 date_add(current_date(),interval 6 year); +------------------------------------------+ | date_add(current_date(),interval 6 year) | +------------------------------------------+ | 2030-02-25 | +------------------------------------------+ 1 row in set (0.004 sec) MariaDB [cumple]> select date_add(current_date(),interval 7 month); +-------------------------------------------+ | date_add(current_date(),interval 7 month) | +-------------------------------------------+ | 2024-09-25 | +-------------------------------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select date_format(now(),'%h:%i:%s %p'); +----------------------------------+ | date_format(now(),'%h:%i:%s %p') | +----------------------------------+ | 11:44:45 AM | +----------------------------------+ 1 row in set (0.000 sec) MariaDB [cumple]> select datediff(current_date(),'1989-03-22'); +---------------------------------------+ | datediff(current_date(),'1989-03-22') | +---------------------------------------+ | 12758 | +---------------------------------------+ 1 row in set (0.003 sec) MariaDB [cumple]> select nombre, year(current_date()) - year(nacimiento) from ejercicio; +-------------------+-----------------------------------------+ | nombre | year(current_date()) - year(nacimiento) | +-------------------+-----------------------------------------+ | Eder Pulgar | 64 | | Juan Carlos Serpa | 42 | | Mariana Gonzalez | 42 | | Yoreida Maria | 46 | | Angel Cuadrado | 58 | | Jorge Fuentes | 44 | | Angela Ruiz | 47 | | Carlota Sonora | 39 | +-------------------+-----------------------------------------+ 8 rows in set (0.005 sec) MariaDB [cumple]> select nombre from ejercicio where sexo='mujer' and nombre like '%a'; +----------------+ | nombre | +----------------+ | Yoreida Maria | | Carlota Sonora | +----------------+ 2 rows in set (0.004 sec) MariaDB [cumple]> select count(*) from ejercicio where sexo='mujer' and nombre like '%a'; +----------+ | count(*) | +----------+ | 2 | +----------+ 1 row in set (0.026 sec) MariaDB [cumple]> select count(*) from ejercicio where year(nacimiento) between '1960'and 1969; +----------+ | count(*) | +----------+ | 2 | +----------+ 1 row in set (0.003 sec) MariaDB [cumple]> select * from ejercicio where year(current_date()) - year(nacimiento) between '34' and '37'; Empty set (0.004 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.003 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]> create view ejercicioa as select * from ejercicio where nombre like'%a'; Query OK, 0 rows affected (0.010 sec) MariaDB [cumple]> describe table ejercicio; 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 'table ejercicio' at line 1 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.019 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]> create view ejercicioa as select * from ejercicio where nombre like'%a'; ERROR 1050 (42S01): Table 'ejercicioa' already exists MariaDB [cumple]> create view ejercicio as select * from ejercicio where nombre like'%a'; ERROR 1050 (42S01): Table 'ejercicio' already exists MariaDB [cumple]> create view ejerciciob as select * from ejercicio where nombre like'%a'; Query OK, 0 rows affected (0.006 sec) MariaDB [cumple]> select * fr0m ejerciciob; 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 'fr0m ejerciciob' at line 1 MariaDB [cumple]> select * from ejerciciob; +------------+-------------------+--------+------------+-------+ | 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.004 sec) MariaDB [cumple]> create view ejercicioc as select * from ejercicio where nombre like'%l'; Query OK, 0 rows affected (0.003 sec) MariaDB [cumple]> select * from ejercicioc; Empty set (0.001 sec) MariaDB [cumple]> create view ejerciciod as select * from ejercicio where nombre like'%z'; Query OK, 0 rows affected (0.006 sec) MariaDB [cumple]> select * from ejerciciod; +------------+------------------+-------+------------+-------+ | codigo | nombre | sexo | nacimiento | hijos | +------------+------------------+-------+------------+-------+ | 0822559966 | Mariana Gonzalez | Mujer | 1982-03-24 | 1 | | 556959966 | Angela Ruiz | Mujer | 1977-11-15 | 1 | +------------+------------------+-------+------------+-------+ 2 rows in set (0.001 sec) MariaDB [cumple]> create view ejerciciosexo as select * from ejercicio where sexo= "hombre"; Query OK, 0 rows affected (0.004 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.005 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.001 sec) MariaDB [cumple]> drop view ejerciciosexo; Query OK, 0 rows affected (0.001 sec) MariaDB [cumple]> drop view ejerciciob; Query OK, 0 rows affected (0.001 sec) MariaDB [cumple]> drop view ejercicioc; Query OK, 0 rows affected (0.001 sec) MariaDB [cumple]> exit;