MariaDB [(none)]> create database tallerdos; ERROR 1007 (HY000): Can't create database 'tallerdos'; database exists MariaDB [(none)]> create database taller_dos; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> use taller_dos; Database changed MariaDB [taller_dos]> create table VENDEDOR -> (Idvendedor varchar(15) not null primary key, -> Nombre varchar(50) not null, -> Porcenta_Comision float not null, -> Zona varchar(30) not null); Query OK, 0 rows affected (1.27 sec) MariaDB [taller_dos]> describe vendedor; +-------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+-------------+------+-----+---------+-------+ | Idvendedor | varchar(15) | NO | PRI | NULL | | | Nombre | varchar(50) | NO | | NULL | | | Porcenta_Comision | float | NO | | NULL | | | Zona | varchar(30) | NO | | NULL | | +-------------------+-------------+------+-----+---------+-------+ 4 rows in set (0.60 sec) MariaDB [taller_dos]> create table CLIENTE -> (Idcliente varchar(15) not null primary key, -> Nombre varchar(50) not null, -> Cupo_Credito float not null); Query OK, 0 rows affected (0.38 sec) MariaDB [taller_dos]> describe cliente; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | Idcliente | varchar(15) | NO | PRI | NULL | | | Nombre | varchar(50) | NO | | NULL | | | Cupo_Credito | float | NO | | NULL | | +--------------+-------------+------+-----+---------+-------+ 3 rows in set (0.01 sec) MariaDB [taller_dos]> insert into vendedor(Idvendedor,Nombre,Porcenta_Comision,Zona) values('001','Luis Meza',0.5,'Norte'); Query OK, 1 row affected (0.13 sec) MariaDB [taller_dos]> insert into vendedor(Idvendedor,Nombre,Porcenta_Comision,Zona) values('002','Camilo Lleras',0.6,'Centro'); Query OK, 1 row affected (0.08 sec) MariaDB [taller_dos]> insert into vendedor(Idvendedor,Nombre,Porcenta_Comision,Zona) values('003','Sergio Agudelo',0.3,'Centro'); Query OK, 1 row affected (0.08 sec) MariaDB [taller_dos]> insert into vendedor(Idvendedor,Nombre,Porcenta_Comision,Zona) values('004','Lina Ocampo',0.5,'Sur'); Query OK, 1 row affected (0.08 sec) MariaDB [taller_dos]> select * from vendedor; +------------+----------------+-------------------+--------+ | Idvendedor | Nombre | Porcenta_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.06 sec) MariaDB [taller_dos]> insert into cliente(Idcliente,Nombre,Cupo_Credito) values('50964','Oscar de Leon',500000); Query OK, 1 row affected (0.10 sec) MariaDB [taller_dos]> insert into cliente(Idcliente,Nombre,Cupo_Credito) values('85963','Ana Palencia',1000000); Query OK, 1 row affected (0.10 sec) MariaDB [taller_dos]> insert into cliente(Idcliente,Nombre,Cupo_Credito) values('25147','Teresa Suarez',1200000); Query OK, 1 row affected (0.08 sec) MariaDB [taller_dos]> insert into cliente(Idcliente,Nombre,Cupo_Credito) values('36259','Shamir Beltran',700000); Query OK, 1 row affected (0.11 sec) MariaDB [taller_dos]> 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.00 sec) MariaDB [taller_dos]> select * from vendedor where zona='norte'; +------------+-----------+-------------------+-------+ | Idvendedor | Nombre | Porcenta_Comision | Zona | +------------+-----------+-------------------+-------+ | 001 | Luis Meza | 0.5 | Norte | +------------+-----------+-------------------+-------+ 1 row in set (0.05 sec) MariaDB [taller_dos]> select * from vendedor where zona='centro'; +------------+----------------+-------------------+--------+ | Idvendedor | Nombre | Porcenta_Comision | Zona | +------------+----------------+-------------------+--------+ | 002 | Camilo Lleras | 0.6 | Centro | | 003 | Sergio Agudelo | 0.3 | Centro | +------------+----------------+-------------------+--------+ 2 rows in set (0.00 sec) MariaDB [taller_dos]> select * from vendedor where porcenta_comision=0.3; Empty set (0.03 sec) MariaDB [taller_dos]> select * from vendedor where porcenta_comision='0.3'; Empty set (0.00 sec) MariaDB [taller_dos]> select * from cliente where cupo_credito>='500000' and cupo_credito >='1000000'; +-----------+---------------+--------------+ | Idcliente | Nombre | Cupo_Credito | +-----------+---------------+--------------+ | 25147 | Teresa Suarez | 1200000 | | 85963 | Ana Palencia | 1000000 | +-----------+---------------+--------------+ 2 rows in set (0.00 sec) MariaDB [taller_dos]> select * from cliente where cupo_credito>='500000' and cupo_credito <='1000000'; +-----------+----------------+--------------+ | Idcliente | Nombre | Cupo_Credito | +-----------+----------------+--------------+ | 36259 | Shamir Beltran | 700000 | | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1000000 | +-----------+----------------+--------------+ 3 rows in set (0.00 sec) MariaDB [taller_dos]> select * from cliente where nombre like'a%' and '%a'; Empty set, 4 warnings (0.03 sec) MariaDB [taller_dos]> select * from cliente where nombre like'a%' and '% a'; Empty set, 4 warnings (0.00 sec) MariaDB [taller_dos]> select * from cliente where nombre like'a%'and'%a'; Empty set, 4 warnings (0.00 sec) MariaDB [taller_dos]> select * from cliente where nombre like'a%'; +-----------+--------------+--------------+ | Idcliente | Nombre | Cupo_Credito | +-----------+--------------+--------------+ | 85963 | Ana Palencia | 1000000 | +-----------+--------------+--------------+ 1 row in set (0.00 sec) MariaDB [taller_dos]> select * from cliente where nombre like'a%' and nombre like'%a'; +-----------+--------------+--------------+ | Idcliente | Nombre | Cupo_Credito | +-----------+--------------+--------------+ | 85963 | Ana Palencia | 1000000 | +-----------+--------------+--------------+ 1 row in set (0.00 sec) MariaDB [taller_dos]> select * from vendedor where nombre like'%a%'; +------------+----------------+-------------------+--------+ | Idvendedor | Nombre | Porcenta_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.00 sec) MariaDB [taller_dos]> select count(*) 'cupo_credito' from cliente; +--------------+ | cupo_credito | +--------------+ | 4 | +--------------+ 1 row in set (0.06 sec) MariaDB [taller_dos]> select sum(cupo_credito) 'Valor Total' from cliente; +-------------+ | Valor Total | +-------------+ | 3400000 | +-------------+ 1 row in set (0.00 sec) MariaDB [taller_dos]> select min(cupo_credito) 'Valor Minimo del Credito' from cliente; +--------------------------+ | Valor Minimo del Credito | +--------------------------+ | 500000 | +--------------------------+ 1 row in set (0.03 sec) MariaDB [taller_dos]> select max(cupo_credito) 'Valor Maximo del Credito' from cliente; +--------------------------+ | Valor Maximo del Credito | +--------------------------+ | 1200000 | +--------------------------+ 1 row in set (0.00 sec) MariaDB [taller_dos]> select avg(cupo_credito) 'Valor Promedio del Credito' from cliente; +----------------------------+ | Valor Promedio del Credito | +----------------------------+ | 850000 | +----------------------------+ 1 row in set (0.00 sec) MariaDB [taller_dos]> select * from cliente order by cupo_credito desc; +-----------+----------------+--------------+ | Idcliente | Nombre | Cupo_Credito | +-----------+----------------+--------------+ | 25147 | Teresa Suarez | 1200000 | | 85963 | Ana Palencia | 1000000 | | 36259 | Shamir Beltran | 700000 | | 50964 | Oscar de Leon | 500000 | +-----------+----------------+--------------+ 4 rows in set (0.04 sec) MariaDB [taller_dos]> 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.00 sec) MariaDB [taller_dos]> select * from vendedor order by nombre desc; +------------+----------------+-------------------+--------+ | Idvendedor | Nombre | Porcenta_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.00 sec) MariaDB [taller_dos]> describe cliente; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | Idcliente | varchar(15) | NO | PRI | NULL | | | Nombre | varchar(50) | NO | | NULL | | | Cupo_Credito | float | NO | | NULL | | +--------------+-------------+------+-----+---------+-------+ 3 rows in set (0.01 sec) MariaDB [taller_dos]> select * from cliente; +-----------+----------------+--------------+ | Idcliente | Nombre | Cupo_Credito | +-----------+----------------+--------------+ | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | | 85963 | Ana Palencia | 1000000 | +-----------+----------------+--------------+ 3 rows in set (0.00 sec) MariaDB [taller_dos]> update vendedor set nombre='Luis Meza' where nombre='Oscar Ivan Figueroa'; Query OK, 0 rows affected (0.06 sec) Rows matched: 0 Changed: 0 Warnings: 0 MariaDB [taller_dos]> selec * from vendedor; 4 rows in set (0.00 sec) MariaDB [taller_dos]> exit