MariaDB [(none)]> create database RETO2; Query OK, 1 row affected (0.004 sec) MariaDB [(none)]> use RETO2; Database changed MariaDB [RETO2]> create tablee Vendedor(idVendedor varchar(4) not null primary key, -> Nombre varchar(30) not null, -> Porcentaje_Comision float(3) not null, -> Zona varchar(20) 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 'tablee Vendedor(idVendedor varchar(4) not null primary key, Nombre varchar(30...' at line 1 MariaDB [RETO2]> create table Vendedor(idVendedor varchar(4) not null primary key, -> Nombre varchar(30) not null, -> Porcentaje_Comision float(3) not null, -> Zona varchar(20) not null); Query OK, 0 rows affected (0.058 sec) MariaDB [RETO2]> describe Vendedor; +---------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------+-------------+------+-----+---------+-------+ | idVendedor | varchar(4) | NO | PRI | NULL | | | Nombre | varchar(30) | NO | | NULL | | | Porcentaje_Comision | float | NO | | NULL | | | Zona | varchar(20) | NO | | NULL | | +---------------------+-------------+------+-----+---------+-------+ 4 rows in set (0.014 sec) MariaDB [RETO2]> create table Cliente(idCliente varchar(4) not null primary key, -> Nombre varchar(30) not null, -> Cupo_Credito float(8) not null); Query OK, 0 rows affected (0.040 sec) MariaDB [RETO2]> describe Cliente; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | idCliente | varchar(4) | NO | PRI | NULL | | | Nombre | varchar(30) | NO | | NULL | | | Cupo_Credito | float | NO | | NULL | | +--------------+-------------+------+-----+---------+-------+ 3 rows in set (0.014 sec) MariaDB [RETO2]> insert into Vendedor(idVendedor, Nombre, Porcentaje_comision, Zona) values('001','LUIS MEZA', 0.5,'NORTE'); Query OK, 1 row affected (0.057 sec) MariaDB [RETO2]> MariaDB [(none)]> create database Reto2; Query OK, 1 row affected (0.003 sec) MariaDB [(none)]> use Reto2; Database changed MariaDB [Reto2]> create table vendedor(Idvendedor varchar(5) not null primary key, -> Nombre varchar(60) not null, -> Porcentaje_Comision float(3) not null, -> Zona varchar(20) not null); Query OK, 0 rows affected (0.030 sec) MariaDB [Reto2]> describe Vendedor; +---------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------+-------------+------+-----+---------+-------+ | Idvendedor | varchar(5) | NO | PRI | NULL | | | Nombre | varchar(60) | NO | | NULL | | | Porcentaje_Comision | float | NO | | NULL | | | Zona | varchar(20) | NO | | NULL | | +---------------------+-------------+------+-----+---------+-------+ 4 rows in set (0.014 sec) MariaDB [Reto2]> create table Cliente(Idcliente varchar(5) not null primary key, -> Nombre varchar(60) not null, -> Cupo_credito float(8) not null); Query OK, 0 rows affected (0.043 sec) MariaDB [Reto2]> describe Cliente; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | Idcliente | varchar(5) | NO | PRI | NULL | | | Nombre | varchar(60) | NO | | NULL | | | Cupo_credito | float | NO | | NULL | | +--------------+-------------+------+-----+---------+-------+ 3 rows in set (0.024 sec) MariaDB [Reto2]> insert into vendedor(idvendedor, Nombre, Porcentaje_comision, zona) values('001','LUIS MEZA', 0.5,'NORTE'); Query OK, 1 row affected (0.014 sec) MariaDB [Reto2]> insert into vendedor(idvendedor, Nombre, Porcentaje_comision, zona) values('002','CAMILO LLERAS', 0.6,'CENTRO'); Query OK, 1 row affected (0.014 sec) MariaDB [Reto2]> insert into vendedor(idvendedor, Nombre, Porcentaje_comision, zona) values('003','SERGIO AGUDELO', 0.3,'CENTRO'); Query OK, 1 row affected (0.014 sec) MariaDB [Reto2]> insert into vendedor(idvendedor, Nombre, Porcentaje_comision, zona) values('004','LINA OCAMPO', 0.5,'SUR'); Query OK, 1 row affected (0.014 sec) MariaDB [Reto2]> select * from vendedor; +------------+----------------+---------------------+--------+ | Idvendedor | Nombre | Porcentaje_Comision | 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]> insert into cliente(idcliente, Nombre, cupo_credito) values('50964','OSCAR DE LEON', 500000); Query OK, 1 row affected (0.015 sec) MariaDB [Reto2]> insert into cliente(idcliente, Nombre, cupo_credito) values('85963','ANA PALENCIA', 1000000); Query OK, 1 row affected (0.014 sec) MariaDB [Reto2]> insert into cliente(idcliente, Nombre, cupo_credito) values('25147','TERESA SUAREZ', 1200000); Query OK, 1 row affected (0.004 sec) MariaDB [Reto2]> insert into cliente(idcliente, Nombre, cupo_credito) values('36259','SHAMIR BELTRAN', 700000); Query OK, 1 row affected (0.017 sec) MariaDB [Reto2]> select * from cliente; +-----------+----------------+--------------+ | Idcliente | Nombre | Cupo_credito | +-----------+----------------+--------------+ | 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 | Porcentaje_Comision | Zona | +------------+-----------+---------------------+-------+ | 001 | LUIS MEZA | 0.5 | NORTE | +------------+-----------+---------------------+-------+ 1 row in set (0.001 sec) MariaDB [Reto2]> select * from vendedor where zona='centro' and comision=0.3; ERROR 1054 (42S22): Unknown column 'comision' in 'where clause' MariaDB [Reto2]> select * from vendedor where zona='centro' and porcentaje_comision=0.3; Empty set (0.012 sec) MariaDB [Reto2]> Select * from vendedor where zona = 'centro'; +------------+----------------+---------------------+--------+ | Idvendedor | Nombre | Porcentaje_Comision | Zona | +------------+----------------+---------------------+--------+ | 002 | CAMILO LLERAS | 0.6 | CENTRO | | 003 | SERGIO AGUDELO | 0.3 | CENTRO | +------------+----------------+---------------------+--------+ 2 rows in set (0.000 sec) MariaDB [Reto2]> MariaDB [(none)]> use Reto2; Database changed MariaDB [Reto2]> Select * from cliente where cupo_credito > 500000 and cupo_credito < 1000000; +-----------+----------------+--------------+ | Idcliente | Nombre | Cupo_credito | +-----------+----------------+--------------+ | 36259 | SHAMIR BELTRAN | 700000 | +-----------+----------------+--------------+ 1 row in set (0.001 sec) MariaDB [Reto2]> Select * from cliente where nombre like 'a%' and nombre like '%a'; +-----------+--------------+--------------+ | Idcliente | Nombre | Cupo_credito | +-----------+--------------+--------------+ | 85963 | ANA PALENCIA | 1000000 | +-----------+--------------+--------------+ 1 row in set (0.001 sec) MariaDB [Reto2]> Select * from cliente where nombre like '%a%'; +-----------+----------------+--------------+ | Idcliente | Nombre | Cupo_credito | +-----------+----------------+--------------+ | 25147 | TERESA SUAREZ | 1200000 | | 36259 | SHAMIR BELTRAN | 700000 | | 50964 | OSCAR DE LEON | 500000 | | 85963 | ANA PALENCIA | 1000000 | +-----------+----------------+--------------+ 4 rows in set (0.001 sec) MariaDB [Reto2]> Select count(cupo_credito) 'Cantidad_de creditos' from cliente; +----------------------+ | Cantidad_de creditos | +----------------------+ | 4 | +----------------------+ 1 row in set (0.001 sec) MariaDB [Reto2]> Select max(cupo_credito) 'Valor_maximo_de creditos' from cliente; +--------------------------+ | Valor_maximo_de creditos | +--------------------------+ | 1200000 | +--------------------------+ 1 row in set (0.000 sec) MariaDB [Reto2]> Select min(cupo_credito) 'Valor_minimo_de creditos' from cliente; +--------------------------+ | Valor_minimo_de creditos | +--------------------------+ | 500000 | +--------------------------+ 1 row in set (0.001 sec) MariaDB [Reto2]> Select sum(cupo_credito) 'Suma_de creditos' from cliente; +------------------+ | Suma_de creditos | +------------------+ | 3400000 | +------------------+ 1 row in set (0.000 sec) MariaDB [Reto2]> Select avg(cupo_credito) 'Promeido_de creditos' from cliente; +----------------------+ | Promeido_de creditos | +----------------------+ | 850000 | +----------------------+ 1 row in set (0.000 sec) MariaDB [Reto2]> Select * from cliente order by (cupo_credito) asc; +-----------+----------------+--------------+ | Idcliente | Nombre | Cupo_credito | +-----------+----------------+--------------+ | 50964 | OSCAR DE LEON | 500000 | | 36259 | SHAMIR BELTRAN | 700000 | | 85963 | ANA PALENCIA | 1000000 | | 25147 | TERESA SUAREZ | 1200000 | +-----------+----------------+--------------+ 4 rows in set (0.001 sec) MariaDB [Reto2]> Select * from vendedor order by nombre desc; +------------+----------------+---------------------+--------+ | Idvendedor | Nombre | Porcentaje_Comision | 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.001 sec) MariaDB [Reto2]> Delete from cliente where cupo_credito<=500000; Query OK, 1 row affected (0.016 sec) MariaDB [Reto2]> select * from cliente; +-----------+----------------+--------------+ | Idcliente | Nombre | Cupo_credito | +-----------+----------------+--------------+ | 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 = 'Andr‚s Quiroga' where idvendedor = '001'; Query OK, 1 row affected (0.012 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [Reto2]> select * from vendedor; +------------+----------------+---------------------+--------+ | Idvendedor | Nombre | Porcentaje_Comision | Zona | +------------+----------------+---------------------+--------+ | 001 | Andr‚s Quiroga | 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