Microsoft Windows [Versión 10.0.19042.1165] (c) Microsoft Corporation. Todos los derechos reservados. Z:\>C: C:\>cd/xampp/mysql/bin C:\xampp\mysql\bin>mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 10.1.36-MariaDB mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> MariaDB [(none)]> create database reto2; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | phpmyadmin | | reto2 | | test | +--------------------+ 6 rows in set (0.02 sec) MariaDB [(none)]> use reto2; Database changed MariaDB [reto2]> create table vendedor, -> '; '> ; '> +' -> '; '> ' -> ; 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 [reto2]> create table vendedor -> (idvendedor, -> ' '> ; '> ' -> ; 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 2 MariaDB [reto2]> create table vendedor -> (idvendedor varchar(10) not null, -> nombre varchar(75) not null, -> porcent_comision int(15) not null, -> zona varchar(35) not null); Query OK, 0 rows affected (0.19 sec) MariaDB [reto2]> show tables; +-----------------+ | Tables_in_reto2 | +-----------------+ | vendedor | +-----------------+ 1 row in set (0.00 sec) MariaDB [reto2]> describe vendedor; +------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+-------------+------+-----+---------+-------+ | idvendedor | varchar(10) | NO | | NULL | | | nombre | varchar(75) | NO | | NULL | | | porcent_comision | int(15) | NO | | NULL | | | zona | varchar(35) | NO | | NULL | | +------------------+-------------+------+-----+---------+-------+ 4 rows in set (0.01 sec) MariaDB [reto2]> select * from vendedor; Empty set (0.00 sec) MariaDB [reto2]> insert into (idvendedor, nombre, porcent_comision, zona) values ('001', 'Luis Meza', 0.5, 'Norte'); 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 '(idvendedor, nombre, porcent_comision, zona) values ('001', 'Luis Meza', 0.5, 'N' at line 1 MariaDB [reto2]> insert into vendedor (idvendedor, nombre, porcent_comision, zona) values ('001', 'Luis Meza', 0.5, 'Norte'); Query OK, 1 row affected (0.03 sec) MariaDB [reto2]> select * from vendedor; +------------+-----------+------------------+-------+ | idvendedor | nombre | porcent_comision | zona | +------------+-----------+------------------+-------+ | 001 | Luis Meza | 1 | Norte | +------------+-----------+------------------+-------+ 1 row in set (0.00 sec) MariaDB [reto2]> drop table vendedor; Query OK, 0 rows affected (0.20 sec) MariaDB [reto2]> show tables; Empty set (0.00 sec) MariaDB [reto2]> create table vendedor -> (idvendedor varchar(10) not null, -> nombre varchar(75) not null, -> porcent_comision varchar(15) not null, -> zona varchar(35) not null); Query OK, 0 rows affected (0.17 sec) MariaDB [reto2]> select * from vendedor; Empty set (0.00 sec) MariaDB [reto2]> describe vendedor; +------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+-------------+------+-----+---------+-------+ | idvendedor | varchar(10) | NO | | NULL | | | nombre | varchar(75) | NO | | NULL | | | porcent_comision | varchar(15) | NO | | NULL | | | zona | varchar(35) | NO | | NULL | | +------------------+-------------+------+-----+---------+-------+ 4 rows in set (0.01 sec) MariaDB [reto2]> insert into (idvendedor, nombre, porcent_comision, zona) values ('001', 'Luis Meza', 0.5, 'Norte'); 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 '(idvendedor, nombre, porcent_comision, zona) values ('001', 'Luis Meza', 0.5, 'N' at line 1 MariaDB [reto2]> insert into vendedor (idvendedor, nombre, porcent_comision, zona) values ('001', 'Luis Meza', 0.5, 'Norte'); Query OK, 1 row affected (0.04 sec) MariaDB [reto2]> select * from vendedor; +------------+-----------+------------------+-------+ | idvendedor | nombre | porcent_comision | zona | +------------+-----------+------------------+-------+ | 001 | Luis Meza | 0.5 | Norte | +------------+-----------+------------------+-------+ 1 row in set (0.00 sec) MariaDB [reto2]> insert into vendedor (idvendedor, nombre, porcent_comision, zona) values ('002', 'Camilo Lleras', 0.6, 'Centro'); Query OK, 1 row affected (0.02 sec) MariaDB [reto2]> insert into vendedor (idvendedor, nombre, porcent_comision, zona) values ('003', 'Sergio Agudelo', 0.3, 'Centro'); Query OK, 1 row affected (0.03 sec) MariaDB [reto2]> insert into vendedor (idvendedor, nombre, porcent_comision, zona) values ('004', 'Lina Ocampo', 0.5, 'Sur'); Query OK, 1 row affected (0.05 sec) MariaDB [reto2]> select * from vendedor; +------------+----------------+------------------+--------+ | idvendedor | nombre | porcent_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 [reto2]> create table cliente -> (idcliente varchar(15) not null, -> nombre varchar(45) not null, -> cupo_credito float(60) not null); ERROR 1063 (42000): Incorrect column specifier for column 'cupo_credito' MariaDB [reto2]> create table cliente -> (idcliente varchar(15) not null, -> nombre varchar(45) not null, -> cupo_credito float(60) not null); ERROR 1063 (42000): Incorrect column specifier for column 'cupo_credito' MariaDB [reto2]> create table cliente -> (idcliente varchar(15) not null, -> nombre varchar(45) not null, -> cp_credito int(60) not null); Query OK, 0 rows affected (0.17 sec) MariaDB [reto2]> drop table cliente; Query OK, 0 rows affected (0.14 sec) MariaDB [reto2]> create table cliente -> (idcliente varchar(15) not null, -> nombre varchar(45) not null, -> cp_credito float(60) not null); ERROR 1063 (42000): Incorrect column specifier for column 'cp_credito' MariaDB [reto2]> create table cliente -> (idcliente varchar(15) not null, -> nombre varchar(45) not null, -> cupo_credito float not null); Query OK, 0 rows affected (0.18 sec) MariaDB [reto2]> show tables, -> ' '> ; '> ' -> ; 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 [reto2]> show tables; +-----------------+ | Tables_in_reto2 | +-----------------+ | cliente | | vendedor | +-----------------+ 2 rows in set (0.00 sec) MariaDB [reto2]> describe vendedor; +------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------+-------------+------+-----+---------+-------+ | idvendedor | varchar(10) | NO | | NULL | | | nombre | varchar(75) | NO | | NULL | | | porcent_comision | varchar(15) | NO | | NULL | | | zona | varchar(35) | NO | | NULL | | +------------------+-------------+------+-----+---------+-------+ 4 rows in set (0.01 sec) MariaDB [reto2]> describe cliente; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | idcliente | varchar(15) | NO | | NULL | | | nombre | varchar(45) | NO | | NULL | | | cupo_credito | float | NO | | NULL | | +--------------+-------------+------+-----+---------+-------+ 3 rows in set (0.01 sec) MariaDB [reto2]> insert into cliente (idcliente, nombre, cupo_credito) values ('50964', 'Oscar de Leon', 500.000); Query OK, 1 row affected (0.03 sec) MariaDB [reto2]> insert into cliente (idcliente, nombre, cupo_credito) values ('85963', 'Ana Palencia', 1.000); Query OK, 1 row affected (0.03 sec) MariaDB [reto2]> insert into cliente (idcliente, nombre, cupo_credito) values ('25147', 'Teresa Suarez', 1.200.000); 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 '.000)' at line 1 MariaDB [reto2]> insert into cliente (idcliente, nombre, cupo_credito) values ('25147', 'Teresa Suarez', 1200000); Query OK, 1 row affected (0.11 sec) MariaDB [reto2]> insert into cliente (idcliente, nombre, cupo_credito) values ('36259', 'Shamir Beltran', 700000); Query OK, 1 row affected (0.05 sec) MariaDB [reto2]> select * from cliente; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 50964 | Oscar de Leon | 500 | | 85963 | Ana Palencia | 1 | | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 4 rows in set (0.00 sec) MariaDB [reto2]> update cliente set cupo_credito where cupo_credito='500000'; 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 'where cupo_credito='500000'' at line 1 MariaDB [reto2]> update cliente set nombre='Oscar de Leon' where cupo_credito='500000'; Query OK, 0 rows affected (0.00 sec) Rows matched: 0 Changed: 0 Warnings: 0 MariaDB [reto2]> select * from cliente; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 50964 | Oscar de Leon | 500 | | 85963 | Ana Palencia | 1 | | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 4 rows in set (0.00 sec) MariaDB [reto2]> update cliente set cupo_credito='500000' where nombre='Oscar de Leon'; Query OK, 1 row affected (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [reto2]> select * from cliente; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1 | | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 4 rows in set (0.00 sec) MariaDB [reto2]> update cliente set cupo_credito='1000000' where nombre='Ana Palencia'; Query OK, 1 row affected (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [reto2]> select * from cliente; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1000000 | | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 4 rows in set (0.00 sec) MariaDB [reto2]> select * from vendedor where zona='Norte'; +------------+-----------+------------------+-------+ | idvendedor | nombre | porcent_comision | zona | +------------+-----------+------------------+-------+ | 001 | Luis Meza | 0.5 | Norte | +------------+-----------+------------------+-------+ 1 row in set (0.00 sec) MariaDB [reto2]> select * from vendedor where zona='Centro' and porcent_comision'0.3'; 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 ''0.3'' at line 1 MariaDB [reto2]> select * from vendedor where zona='Centro' and porcent_comision='0.3'; +------------+----------------+------------------+--------+ | idvendedor | nombre | porcent_comision | zona | +------------+----------------+------------------+--------+ | 003 | Sergio Agudelo | 0.3 | Centro | +------------+----------------+------------------+--------+ 1 row in set (0.00 sec) MariaDB [reto2]> select * from cliente where cupo_credito='Centro' and porcent_comision='0.3'; ERROR 1054 (42S22): Unknown column 'porcent_comision' in 'where clause' MariaDB [reto2]> select * from cliente where cupo_credito between 500000 and 1000000; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1000000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 3 rows in set (0.00 sec) MariaDB [reto2]> select * from cliente where nombre like 'a%' and '%a'; Empty set, 4 warnings (0.00 sec) MariaDB [reto2]> select * from cliente where nombre like 'a%' and like '%a'; 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 'like '%a'' at line 1 MariaDB [reto2]> select * from cliente where nombre like '%a%; '> ' -> ; Empty set (0.00 sec) MariaDB [reto2]> select * from cliente where nombre like '%a%'; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1000000 | | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 4 rows in set (0.00 sec) MariaDB [reto2]> select * from cliente where nombre like 'a%' or nombre like '%a'; +-----------+--------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+--------------+--------------+ | 85963 | Ana Palencia | 1000000 | +-----------+--------------+--------------+ 1 row in set (0.00 sec) MariaDB [reto2]> select * from cliente where nombre like '%a%'; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1000000 | | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 4 rows in set (0.00 sec) MariaDB [reto2]> select sum(cupo_credito) 'VALOR TOTAL' from cliente; +-------------+ | VALOR TOTAL | +-------------+ | 3400000 | +-------------+ 1 row in set (0.00 sec) MariaDB [reto2]> select max(cupo_credito) 'VALOR MAXIMO' from cliente; +--------------+ | VALOR MAXIMO | +--------------+ | 1200000 | +--------------+ 1 row in set (0.00 sec) MariaDB [reto2]> select min(cupo_credito) 'VALOR MINIMO' from cliente; +--------------+ | VALOR MINIMO | +--------------+ | 500000 | +--------------+ 1 row in set (0.00 sec) MariaDB [reto2]> select count(cupo_credito) 'CANTIDAD' from cliente; +----------+ | CANTIDAD | +----------+ | 4 | +----------+ 1 row in set (0.00 sec) MariaDB [reto2]> select avg(cupo_credito) 'PROMEDIO' from cliente; +----------+ | PROMEDIO | +----------+ | 850000 | +----------+ 1 row in set (0.00 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.00 sec) MariaDB [reto2]> select * from vendedor order by (nombre) desc; +------------+----------------+------------------+--------+ | idvendedor | nombre | porcent_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 [reto2]> select * from clientes; ERROR 1146 (42S02): Table 'reto2.clientes' doesn't exist MariaDB [reto2]> select * from cliente; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 50964 | Oscar de Leon | 500000 | | 85963 | Ana Palencia | 1000000 | | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 4 rows in set (0.00 sec) MariaDB [reto2]> delete from cliente where cupo_credito <= 500000; Query OK, 1 row affected (0.04 sec) MariaDB [reto2]> select * from cliente; +-----------+----------------+--------------+ | idcliente | nombre | cupo_credito | +-----------+----------------+--------------+ | 85963 | Ana Palencia | 1000000 | | 25147 | Teresa Suarez | 1200000 | | 36259 | Shamir Beltran | 700000 | +-----------+----------------+--------------+ 3 rows in set (0.00 sec) MariaDB [reto2]> select * from vendedor; +------------+----------------+------------------+--------+ | idvendedor | nombre | porcent_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 [reto2]> update vendedor set nombre='Alison Gonzalez' where idvendedor='001'; Query OK, 1 row affected (0.04 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [reto2]> select * from vendedor; +------------+-----------------+------------------+--------+ | idvendedor | nombre | porcent_comision | zona | +------------+-----------------+------------------+--------+ | 001 | Alison Gonzalez | 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 [reto2]>