MariaDB [(none)]> create database practicaf; Query OK, 1 row affected (0.007 sec) MariaDB [(none)]> use practicaf; Database changed MariaDB [practicaf]> create table estudiante( -> ; 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 [practicaf]> create table estudiante -> (carnet entero(3) not null primary key, -> ; 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 '(3) not null primary key,' at line 2 MariaDB [practicaf]> create table estudiante -> (carnet int(3) not null primary key, -> nombre varchar(40) not null, -> fechamatricula date(15) not null, -> fechanacimiento date(15) not null, -> sexo varchar(3) not null); 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 '(15) not null, fechanacimiento date(15) not null, sexo varchar(3) not null)' at line 4 MariaDB [practicaf]> create table estudiante -> (carnet int(3) not null primary key, -> nombre varchar(40) not null, -> fechamatricula datetime(15) not null, -> fechanacimiento datetime(15) not null, -> sexo varchar(1) not null); ERROR 1426 (42000): Too big precision 15 specified for 'fechamatricula'. Maximum is 6 MariaDB [practicaf]> create table estudiante -> (carnet int(3) not null primary key, -> nombre varchar(40) not null, -> fechamatricula datetime(6) not null, -> fechanacimiento date(12) not null,; 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 '(12) not null,' at line 5 MariaDB [practicaf]> create table estudiante( -> carnet int(3) not null primary key, -> nombre varchar (50) not null, -> fechamatricula date (12) not null, -> fechanacimiento date (12) not null, -> sexo char(1) not null); 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 '(12) not null, fechanacimiento date (12) not null, sexo char(1) not null)' at line 4 MariaDB [practicaf]> create table estudiante( -> (carnet int(3) not null primary key, -> nombre varchar(40) not null, -> fechamatricula date not null, -> fechanacimiento date not null, -> sexo char (1) not null ); 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 int(3) not null primary key, nombre varchar(40) not null, fechamatricu...' at line 2 MariaDB [practicaf]> create table estudiante( -> carnet int(3) not null primary key, -> nombre varchar(40) not null, -> fechamatricula date not null, -> fechanacimiento date not null, -> sexo char (1) not null ); Query OK, 0 rows affected (0.021 sec) MariaDB [practicaf]> insert into estudiante values -> ('001', 'maria', '2010-01-15', '1966-05-13', 'f'), -> ('002', 'juana', '2010-06-08', '1973-01-22', 'f'), -> ('003', 'carlos', '2010-06-28', '1976-03-05', 'm'), -> ('004', 'Maria Parra', '2010-06-11', '1976-08-15', 'f'), -> ('005', 'Pablo Neruda', '2011-02-13', '1990-08-25', 'm'), -> ('006', 'Bladimir Palacio', '2011-02-04', '1994-09-03', 'm'), -> ('007', 'Apolonia Serrano', '2011-02-28', '1994-03-09', 'f'), -> ('008', 'Federico Serrano', '2011-03-05', '1991-06-10', 'm'); Query OK, 8 rows affected (0.086 sec) Records: 8 Duplicates: 0 Warnings: 0 MariaDB [practicaf]> create table materia( -> codigom varchar(3) not null primary key, -> descripcion varchar(40) not null, -> valor int not null ); Query OK, 0 rows affected (0.027 sec) MariaDB [practicaf]> insert into materia values -> ('001', 'software I', 320000), -> ('002', 'software II', 328000), -> ('003', 'software III', 400000), -> ('004', 'matematicas', 300000), -> ('005', 'ingles', 300000); Query OK, 5 rows affected (0.017 sec) Records: 5 Duplicates: 0 Warnings: 0 MariaDB [practicaf]> create table estmat( -> carnet int(3) not null, -> codigom varchar(3) not null, -> foreign key (carnet) references estudiante(carnet), -> foreign key (codigom) refererences materia(codigom) ); 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 'refererences materia(codigom) )' at line 5 MariaDB [practicaf]> create table estmat( -> carnet int(3) not null, -> codigom varchar(3) not null, -> foreign key (carnet) references estudiante(carnet), -> foreign key (codigom) refererences materia(codigom); 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 'refererences materia(codigom)' at line 5 MariaDB [practicaf]> create table estmat -> (carnet int(3) not null, -> codigom varchar(3) not null, -> foreign key(carnet) references estudiante(carnet) on delete cascade on update cascade, -> foreign key (codigom) refererences materia(codigom) on delete cascade on update cascade); 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 'refererences materia(codigom) on delete cascade on update cascade)' at line 5 MariaDB [practicaf]> create table estmat -> (carnet int(3) not null, -> codigom varchar(3) not null, -> foreign key(carnet) references estudiante(carnet) on delete cascade on update cascade, -> foreign key (codigom) references materia(codigom) on delete cascade on update cascade); Query OK, 0 rows affected (0.039 sec) MariaDB [practicaf]> insert into estmat values -> ('001', '003'), -> ('001', '005'), -> ('002', '002'), -> ('002', '003'), -> ('002', '004'), -> ('003', '004'), -> ('003', '001'), -> ('004', '004'), -> ('004', '005'), -> ('005', '002'), -> ('005', '005'), -> ('006', '001'), -> ('006', '005'), -> ('007', '003'), -> ('007', '004'), -> ('008', '001'), -> ('008', '004'), -> ('008', '005'); Query OK, 18 rows affected (0.017 sec) Records: 18 Duplicates: 0 Warnings: 0 MariaDB [practicaf]> create table repaso2 -> (codigo int(6) not null primary key, -> nombre varchar(50) not null, -> sexo varchar(10) nor null, -> fechanacimiento date not null, -> nrohijos int(1) not null ); 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 'null, fechanacimiento date not null, nrohijos int(1) not null )' at line 4 MariaDB [practicaf]> create table repaso2 -> (codigo int(6) not null primary key, -> nombre varchar(50) not null, -> sexo varchar(10) nor null, -> fechanacimiento date not null, -> nrohijos int not null ); 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 'null, fechanacimiento date not null, nrohijos int not null )' at line 4 MariaDB [practicaf]> create table repaso2 -> (codigo int(6) not null primary key, -> nombre varchar(50) not null, -> sexo varchar(10) nor null, -> fechanacimiento date not null, -> nrohijos int(2) not null ); 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 'null, fechanacimiento date not null, nrohijos int(2) not null )' at line 4 MariaDB [practicaf]> create table repaso2 -> (codigo int(6) not null primary key, -> nombre varchar(50) not null, -> sexo varchar(10) not null, -> fechanacimiento date not null, -> nrohijos int(2) not null ); Query OK, 0 rows affected (0.022 sec) MariaDB [practicaf]> insert into repaso2 values -> (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); Query OK, 11 rows affected (0.014 sec) Records: 11 Duplicates: 0 Warnings: 0 MariaDB [practicaf]> select count(*) as total_estudiantes_70s -> from estudiante -> where fechanacimiento between '1970-01-01' and '1979-12-31'; +-----------------------+ | total_estudiantes_70s | +-----------------------+ | 3 | +-----------------------+ 1 row in set (0.001 sec) MariaDB [practicaf]> select * -> from estudiante -> where timestampdiff(year, fechanacimiento, curdate()) between 16 and 20; Empty set (0.001 sec) MariaDB [practicaf]> select nombre -> from estudiante -> where timestampdiff(year, fechanacimiento, curdate()) > 25; +------------------+ | nombre | +------------------+ | maria | | juana | | carlos | | Maria Parra | | Pablo Neruda | | Bladimir Palacio | | Apolonia Serrano | | Federico Serrano | +------------------+ 8 rows in set (0.001 sec) MariaDB [practicaf]> select nombre, timestampdiff(year, fechanacimiento, curdate()) as edad from estudiante; +------------------+------+ | nombre | edad | +------------------+------+ | maria | 58 | | juana | 52 | | carlos | 49 | | Maria Parra | 48 | | Pablo Neruda | 34 | | Bladimir Palacio | 30 | | Apolonia Serrano | 31 | | Federico Serrano | 33 | +------------------+------+ 8 rows in set (0.001 sec) MariaDB [practicaf]> select count(*) as mujeres_teminan_en_z -> from repaso2 -> where sexo = 'mujer' and nombre like '%z'; +----------------------+ | mujeres_teminan_en_z | +----------------------+ | 4 | +----------------------+ 1 row in set (0.011 sec) MariaDB [practicaf]> select count(*) as total_nacidos_70s -> from repaso2 -> where fechanacimiento between '1970-01-01' and '1979-12-31'; +-------------------+ | total_nacidos_70s | +-------------------+ | 4 | +-------------------+ 1 row in set (0.001 sec) MariaDB [practicaf]> select * -> from repaso2 -> where timestampdiff(year, fechanacimiento, curdate()) between 25 and 30; Empty set (0.002 sec) MariaDB [practicaf]> select nrohijos, count(*) as cantidad_personas -> from repaso2 -> group by nrohijos; +----------+-------------------+ | nrohijos | cantidad_personas | +----------+-------------------+ | 1 | 4 | | 2 | 4 | | 3 | 2 | | 4 | 1 | +----------+-------------------+ 4 rows in set (0.001 sec) MariaDB [practicaf]> select count(*) as total_carlos -> from repaso2 -> where nombre like 'carlos%'; +--------------+ | total_carlos | +--------------+ | 2 | +--------------+ 1 row in set (0.001 sec) MariaDB [practicaf]> select count(*) as mujeres_menores_igual_22 -> from repaso2 -> where sexo = 'mujer' and timestampdiff(year, fechanacimiento, curdate()) <= 22; +--------------------------+ | mujeres_menores_igual_22 | +--------------------------+ | 0 | +--------------------------+ 1 row in set (0.001 sec) MariaDB [practicaf]> select count (*) as gombres_mayores_30_mas_de_1_hijo -> from repaso2 -> where sexo = 'hombre' -> and timestampdiff(year, fechanacimiento, curdate()) > 30 -> and nrohijos > 1; 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 '*) as gombres_mayores_30_mas_de_1_hijo from repaso2 where sexo = 'hombre' and...' at line 1 MariaDB [practicaf]> select count(*) as hombres_mayores_30_mas_de_1_hijo -> from repaso2 -> where sexo = 'hombre' -> and timestampdiff(year, fechanacimiento, curdate()) > 30 -> and nrohijos >1; +----------------------------------+ | hombres_mayores_30_mas_de_1_hijo | +----------------------------------+ | 3 | +----------------------------------+ 1 row in set (0.001 sec) MariaDB [practicaf]> select count(*) as mujeres_25_1_3_hijos -> from repaso2 -> where sexo = 'mujer' -> and timestampdiff(year, fechanacimiento, curdate()) > 25 -> and nrohijos between 1 and 3; +----------------------+ | mujeres_25_1_3_hijos | +----------------------+ | 7 | +----------------------+ 1 row in set (0.002 sec) MariaDB [practicaf]> select nombre, timestimepdiff(year, fechanacimiento, curdate()) as edad_aproximada -> from repaso2; ERROR 1305 (42000): FUNCTION practicaf.timestimepdiff does not exist MariaDB [practicaf]> select nombre, timestampdiff(year, fechanacimiento, curdate()) as edad_aproximada -> from repaso2; +-------------------+-----------------+ | nombre | edad_aproximada | +-------------------+-----------------+ | carlos ramirez | 56 | | andrea gutierrez | 40 | | marina ruiz | 46 | | gladys bermudez | 46 | | sandra henao | 42 | | carlos sepulveda | 51 | | fernando perez | 44 | | mario gomez | 42 | | juliana arredondo | 36 | | isabel betancur | 47 | | veronica gonzalez | 43 | +-------------------+-----------------+ 11 rows in set (0.001 sec) MariaDB [practicaf]> mysqldump -B -uroot -p practicaf>c:/xampp/practicaf.sql -> ; 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 'mysqldump -B -uroot -p practicaf>c:/xampp/practicaf.sql' at line 1 MariaDB [practicaf]> exit