MariaDB [(none)]> create database reto2; Query OK, 1 row affected (0.002 sec) MariaDB [(none)]> showdatabases; 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 'showdatabases' at line 1 MariaDB [(none)]> show databases; +-----------------------+ | Database | +-----------------------+ | information_schema | | institucion_educativa | | libreria | | librerias | | mysql | | performance_schema | | phpmyadmin | | reto2 | | test | +-----------------------+ 9 rows in set (0.001 sec) MariaDB [(none)]> use reto2; Database changed MariaDB [reto2]> show tables; Empty set (0.001 sec) MariaDB [reto2]> create table vendedor (idvendedor char(3) not null primary key, nombre char(25) not null, Pcomision float(3) not null, zona char(10) not null); Query OK, 0 rows affected (0.040 sec) MariaDB [reto2]> show tables; +-----------------+ | Tables_in_reto2 | +-----------------+ | vendedor | +-----------------+ 1 row in set (0.001 sec) MariaDB [reto2]> create table cliente (idcliente int(5) not null primary key, nombre char(25) not null, Cupocredito float(10) not null); Query OK, 0 rows affected (0.035 sec) MariaDB [reto2]> show tables; +-----------------+ | Tables_in_reto2 | +-----------------+ | cliente | | vendedor | +-----------------+ 2 rows in set (0.001 sec) MariaDB [reto2]> describe vendedor; +------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+----------+------+-----+---------+-------+ | idvendedor | char(3) | NO | PRI | NULL | | | nombre | char(25) | NO | | NULL | | | Pcomision | float | NO | | NULL | | | zona | char(10) | NO | | NULL | | +------------+----------+------+-----+---------+-------+ 4 rows in set (0.026 sec) MariaDB [reto2]> describe cliente; +-------------+----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+----------+------+-----+---------+-------+ | idcliente | int(5) | NO | PRI | NULL | | | nombre | char(25) | NO | | NULL | | | Cupocredito | float | NO | | NULL | | +-------------+----------+------+-----+---------+-------+ 3 rows in set (0.020 sec) MariaDB [reto2]> insert into vendedor(idvendedor,nombre, Pcomision,zona) values('001','Luis Meza',0.5,'Norte'); Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> insert into vendedor(idvendedor,nombre,Pcomision,zona) values('002','Camilo Lleras',0.6,'Centro'); Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> MariaDB [reto2]> insert into vendedor(idvendedor,nombre,Pcomision,zona) values('003','sergio Agudelo',0.3,'Centro'); Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> MariaDB [reto2]> insert into vendedor(idvendedor,nombre,Pcomision,zona) values('004','Lina Ocampo',0.5,'Sur'); Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> select * from vendedor; +------------+----------------+-----------+--------+ | idvendedor | nombre | Pcomision | zona | +------------+----------------+-----------+--------+ | 001 | Luis Meza | 0.5 | Norte | | 002 | Camilo Lleras | 0.6 | Centro | | 003 | sergio Agudelo | 0.3 | Centro | | 004 | Lina Ocampo | 0.5 | Sur | +------------+----------------+-----------+--------+ 4 rows in set (0.001 sec) MariaDB [reto2]> insert into cliente(idcliente,nombre,Cupocredito) values(50964,'Oscar de Leon',500000); Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> MariaDB [reto2]> insert into cliente(idcliente,nombre,Cupocredito) values(85963,'Ana Palencia',1000000); Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> MariaDB [reto2]> insert into cliente(idcliente,nombre,Cupocredito) values(25147,'Teresa Suarez',1200000); Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> MariaDB [reto2]> insert into cliente(idcliente,nombre,Cupocredito) values(36259,'Shamir Beltran',700000); Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> select * from cliente; +-----------+----------------+-------------+ | idcliente | nombre | Cupocredito | +-----------+----------------+-------------+ | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1000000 | +-----------+----------------+-------------+ 4 rows in set (0.000 sec) MariaDB [reto2]> SELECT * FROM vendedor WHERE Zona = 'Norte' ; +------------+-----------+-----------+-------+ | idvendedor | nombre | Pcomision | zona | +------------+-----------+-----------+-------+ | 001 | Luis Meza | 0.5 | Norte | +------------+-----------+-----------+-------+ 1 row in set (0.000 sec) MariaDB [reto2]> ALTER TABLE vendedor MODIFY Pcomision char(3); Query OK, 4 rows affected (0.074 sec) Records: 4 Duplicates: 0 Warnings: 0 MariaDB [reto2]> SELECT * FROM vendedor WHERE zona= 'Centro' and Pcomision ='0.3'; +------------+----------------+-----------+--------+ | idvendedor | nombre | Pcomision | zona | +------------+----------------+-----------+--------+ | 003 | sergio Agudelo | 0.3 | Centro | +------------+----------------+-----------+--------+ 1 row in set (0.002 sec) MariaDB [reto2]> SELECT * FROM Cliente WHERE Cupocredito BETWEEN 500000 AND 1000000; +-----------+----------------+-------------+ | idcliente | nombre | Cupocredito | +-----------+----------------+-------------+ | 36259 | Shamir Beltran | 700000 | | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1000000 | +-----------+----------------+-------------+ 3 rows in set (0.000 sec) MariaDB [reto2]> SELECT * FROM Cliente WHERE Nombre LIKE "A%" AND Nombre LIKE "%A" -> ; +-----------+--------------+-------------+ | idcliente | nombre | Cupocredito | +-----------+--------------+-------------+ | 85963 | Ana Palencia | 1000000 | +-----------+--------------+-------------+ 1 row in set (0.000 sec) MariaDB [reto2]> SELECT * FROM Vendedor WHERE Nombre LIKE "%A%"; +------------+----------------+-----------+--------+ | idvendedor | nombre | Pcomision | zona | +------------+----------------+-----------+--------+ | 001 | Luis Meza | 0.5 | Norte | | 002 | Camilo Lleras | 0.6 | Centro | | 003 | sergio Agudelo | 0.3 | Centro | | 004 | Lina Ocampo | 0.5 | Sur | +------------+----------------+-----------+--------+ 4 rows in set (0.000 sec) MariaDB [reto2]> SELECT SUM(Cupocredito) 'Suma' FROM Cliente; +---------+ | Suma | +---------+ | 3400000 | +---------+ 1 row in set (0.000 sec) MariaDB [reto2]> SELECT MAX(Cupocredito) 'Valor maximo' FROM Cliente; +--------------+ | Valor maximo | +--------------+ | 1200000 | +--------------+ 1 row in set (0.000 sec) MariaDB [reto2]> SELECT MIN(Cupocredito) 'Valor minimo' FROM Cliente; +--------------+ | Valor minimo | +--------------+ | 500000 | +--------------+ 1 row in set (0.000 sec) MariaDB [reto2]> SELECT COUNT(Cupocredito) FROM Cliente; +--------------------+ | COUNT(Cupocredito) | +--------------------+ | 4 | +--------------------+ 1 row in set (0.000 sec) MariaDB [reto2]> SELECT AVG(Cupocredito) 'Valor promedio' FROM Cliente; +----------------+ | Valor promedio | +----------------+ | 850000 | +----------------+ 1 row in set (0.000 sec) MariaDB [reto2]> SELECT * FROM Cliente ORDER By Cupocredito ASC; +-----------+----------------+-------------+ | idcliente | nombre | Cupocredito | +-----------+----------------+-------------+ | 50964 | Oscar de Leon | 500000 | | 36259 | Shamir Beltran | 700000 | | 85963 | Ana Palencia | 1000000 | | 25147 | Teresa Suarez | 1200000 | +-----------+----------------+-------------+ 4 rows in set (0.000 sec) MariaDB [reto2]> SELECT * FROM Vendedor ORDER By Nombre DESC; +------------+----------------+-----------+--------+ | idvendedor | nombre | Pcomision | zona | +------------+----------------+-----------+--------+ | 003 | sergio Agudelo | 0.3 | Centro | | 001 | Luis Meza | 0.5 | Norte | | 004 | Lina Ocampo | 0.5 | Sur | | 002 | Camilo Lleras | 0.6 | Centro | +------------+----------------+-----------+--------+ 4 rows in set (0.000 sec) MariaDB [reto2]> DELETE FROM Cliente WHERE Cupocredito <= 500000; Query OK, 1 row affected (0.002 sec) MariaDB [reto2]> select * from cliente; +-----------+----------------+-------------+ | idcliente | nombre | Cupocredito | +-----------+----------------+-------------+ | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | | 85963 | Ana Palencia | 1000000 | +-----------+----------------+-------------+ 3 rows in set (0.000 sec) MariaDB [reto2]> UPDATE Vendedor SET Nombre = 'Sebastian Henao Lopez' Where idvendedor= 001; Query OK, 1 row affected (0.002 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [reto2]> select * from vendedor; +------------+-----------------------+-----------+--------+ | idvendedor | nombre | Pcomision | zona | +------------+-----------------------+-----------+--------+ | 001 | Sebastian Henao Lopez | 0.5 | Norte | | 002 | Camilo Lleras | 0.6 | Centro | | 003 | sergio Agudelo | 0.3 | Centro | | 004 | Lina Ocampo | 0.5 | Sur | +------------+-----------------------+-----------+--------+ 4 rows in set (0.000 sec) MariaDB [reto2]> exit