MariaDB [fechas]> show databases; +--------------------+ | Database | +--------------------+ | academico | | aplicacion_cadena | | comercial | | consulta_externa | | facturacion | | fechas | | fechas001 | | information_schema | | institucion | | institucion1 | | libreria | | matricula2 | | mysql | | performance_schema | | phpmyadmin | | secundaria | | test | | urgencias | +--------------------+ 18 rows in set (0.03 sec) MariaDB [fechas]> show tables; +------------------+ | Tables_in_fechas | +------------------+ | estmat | | estudiante | | materia | | repaso2 | +------------------+ 4 rows in set (0.00 sec) MariaDB [fechas]> select * from repaso2; +--------+-------------------+--------+-----------------+----------+ | codigo | nombre | sexo | fechanacimiento | nrohijos | +--------+-------------------+--------+-----------------+----------+ | 111222 | carlos ramirez | hombre | 1969-04-04 | 2 | | 333666 | marina ruiz | mujer | 1978-12-15 | 3 | | 999111 | veronica gonzalez | mujer | 1982-03-30 | 1 | | 888777 | isabel betancur | mujer | 1977-11-15 | 1 | | 333777 | gladys bermudez | mujer | 1979-01-01 | 2 | | 444666 | sandra henao | mujer | 1982-11-25 | 3 | | 555777 | mario gomez | hombre | 1982-05-29 | 2 | | 111333 | andrea gutierrez | mujer | 1985-04-12 | 1 | | 444777 | carlos sepulveda | hombre | 1974-01-10 | 1 | | 555333 | fernando perez | hombre | 1980-11-11 | 4 | | 666555 | juliana arredondo | mujer | 1988-12-31 | 2 | +--------+-------------------+--------+-----------------+----------+ 11 rows in set (0.00 sec) MariaDB [fechas]> select * from repaso2 where nombre like '%z'; +--------+-------------------+--------+-----------------+----------+ | codigo | nombre | sexo | fechanacimiento | nrohijos | +--------+-------------------+--------+-----------------+----------+ | 111222 | carlos ramirez | hombre | 1969-04-04 | 2 | | 333666 | marina ruiz | mujer | 1978-12-15 | 3 | | 999111 | veronica gonzalez | mujer | 1982-03-30 | 1 | | 333777 | gladys bermudez | mujer | 1979-01-01 | 2 | | 555777 | mario gomez | hombre | 1982-05-29 | 2 | | 111333 | andrea gutierrez | mujer | 1985-04-12 | 1 | | 555333 | fernando perez | hombre | 1980-11-11 | 4 | +--------+-------------------+--------+-----------------+----------+ 7 rows in set (0.00 sec) MariaDB [fechas]> select count(*) from repaso2 where sexo= 'mujer' and nombre like '%z' ; +----------+ | count(*) | +----------+ | 4 | +----------+ 1 row in set (0.00 sec) MariaDB [fechas]> select count(*) from repaso2 where year(fechanacimiento) between 1970 and 1979; +----------+ | count(*) | +----------+ | 4 | +----------+ 1 row in set (0.00 sec) MariaDB [fechas]> select * from repaso2 where year (current_date()) - year(fechanacimiento) between '25' and '30' ; Empty set (0.00 sec) MariaDB [fechas]> select sum(nrohijos) from repaso2; +---------------+ | sum(nrohijos) | +---------------+ | 22 | +---------------+ 1 row in set (0.04 sec) MariaDB [fechas]> select nrohijos, count(*) padres from repaso2 group by nrohijos; +----------+--------+ | nrohijos | padres | +----------+--------+ | 1 | 4 | | 2 | 4 | | 3 | 2 | | 4 | 1 | +----------+--------+ 4 rows in set (0.04 sec) MariaDB [fechas]> select count(*) from repaso2 where sexo= 'hombre' and nombre like 'carlos%' ; +----------+ | count(*) | +----------+ | 2 | +----------+ 1 row in set (0.00 sec) MariaDB [fechas]> select * from repaso2 where nombre like '%carlos%'; +--------+------------------+--------+-----------------+----------+ | codigo | nombre | sexo | fechanacimiento | nrohijos | +--------+------------------+--------+-----------------+----------+ | 111222 | carlos ramirez | hombre | 1969-04-04 | 2 | | 444777 | carlos sepulveda | hombre | 1974-01-10 | 1 | +--------+------------------+--------+-----------------+----------+ 2 rows in set (0.00 sec) MariaDB [fechas]> select count(*) from repaso2 where year (current_date) - year (fechanacimiento)<=22 and sexo='mujer'; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set (0.00 sec) MariaDB [fechas]> select * from repaso2 where year (current_date) - year (fechanacimiento)<=22 and sexo='mujer'; Empty set (0.00 sec) MariaDB [fechas]> select count(*) from repaso2 where year (current_date) - year (fechanacimiento)>30 and sexo='hombre'; +----------+ | count(*) | +----------+ | 4 | +----------+ 1 row in set (0.00 sec) MariaDB [fechas]> select count(*) from repaso2 where sexo='hombre' and nrohijos>1 and substr(fechanacimiento,1,4)< 1989; +----------+ | count(*) | +----------+ | 3 | +----------+ 1 row in set (0.03 sec) MariaDB [fechas]> select count(*) from repaso2 where year (current_date) - year (fechanacimiento)>25 and sexo='mujer'and nrohijos between '1' and '3'; +----------+ | count(*) | +----------+ | 7 | +----------+ 1 row in set (0.00 sec) MariaDB [fechas]> select count(*) from repaso2 where sexo='mujer' and nrohijos>1 and substr(fechanacimiento,1,4)< 1994; +----------+ | count(*) | +----------+ | 4 | +----------+ 1 row in set (0.00 sec) MariaDB [fechas]> select time (now()); +--------------+ | time (now()) | +--------------+ | 18:38:36 | +--------------+ 1 row in set (0.04 sec) MariaDB [fechas]> select current_date(); +----------------+ | current_date() | +----------------+ | 2019-08-24 | +----------------+ 1 row in set (0.00 sec) MariaDB [fechas]> exit