Microsoft Windows [Versión 10.0.22631.3374] (c) Microsoft Corporation. Todos los derechos reservados. C:\Users\Usuario>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 9 Server version: 10.4.32-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)]> create database reto2; ERROR 1007 (HY000): Can't create database 'reto2'; database exists MariaDB [(none)]> Query OK, 1 row affected (0.001 sec) -> use reto2 -> ; 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 'Query OK, 1 row affected (0.001 sec) use reto2' at line 1 MariaDB [(none)]> use reto2 Database changed MariaDB [reto2]> create table vendedor -> (idvendedor varchar(3) not null primary key, -> nombre varchar(30) not null, -> porcentajecomision varchar(5) not null, -> zona varchar(15) not null); Query OK, 0 rows affected (0.018 sec) MariaDB [reto2]> describe vendedor; +--------------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------------+-------------+------+-----+---------+-------+ | idvendedor | varchar(3) | NO | PRI | NULL | | | nombre | varchar(30) | NO | | NULL | | | porcentajecomision | varchar(5) | NO | | NULL | | | zona | varchar(15) | NO | | NULL | | +--------------------+-------------+------+-----+---------+-------+ 4 rows in set (0.013 sec) MariaDB [reto2]> create table cliente -> (idcliente varchar(15) not null primary key, -> nombre varchar(30) not null, -> cupocredito float not null); Query OK, 0 rows affected (0.022 sec) MariaDB [reto2]> describe cliente; +-------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-------------+------+-----+---------+-------+ | idcliente | varchar(15) | NO | PRI | NULL | | | nombre | varchar(30) | NO | | NULL | | | cupocredito | float | NO | | NULL | | +-------------+-------------+------+-----+---------+-------+ 3 rows in set (0.024 sec) MariaDB [reto2]> insert into cliente -> (idcliente, nombre, cupocredito)values('50964','Oscar de Le n',500000); Query OK, 1 row affected (0.015 sec) MariaDB [reto2]> insert into cliente -> insert into cliente -> (idcliente, nombre, cupocredito)values('85963','Ana Valencia',1000000); 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 'insert into cliente (idcliente, nombre, cupocredito)values('85963','Ana Valen...' at line 2 MariaDB [reto2]> insert into cliente -> (idcliente, nombre, cupocredito)values('25147','Teresa Su rez',1200000); Query OK, 1 row affected (0.011 sec) MariaDB [reto2]> insert into cliente -> (idcliente, nombre, cupocredito)values('36259','Shamir Beltr n',700000); Query OK, 1 row affected (0.003 sec) MariaDB [reto2]> insert into vendedor -> (5','Norte'); '> (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 '5','Norte'); (5','Norte')' at line 2 MariaDB [reto2]> insert into vendedor -> (idvendedor, nombre, porcentajecomision, zona)values('002','Camilo Lleras','0.6','Centro'); Query OK, 1 row affected (0.011 sec) MariaDB [reto2]> insert into vendedor -> (idvendedor, nombre, porcentajecomision, zona)values('003','Sergio Agudelo','0.3','Centro'); Query OK, 1 row affected (0.011 sec) MariaDB [reto2]> insert into vendedor -> (idvendedor, nombre, porcentajecomision, zona)values('004','Lina Ocampo','0.5','Sur'); Query OK, 1 row affected (0.011 sec) MariaDB [reto2]> select * from vendedor; +------------+----------------+--------------------+--------+ | idvendedor | nombre | porcentajecomision | zona | +------------+----------------+--------------------+--------+ | 002 | Camilo Lleras | 0.6 | Centro | | 003 | Sergio Agudelo | 0.3 | Centro | | 004 | Lina Ocampo | 0.5 | Sur | +------------+----------------+--------------------+--------+ 3 rows in set (0.000 sec) MariaDB [reto2]> [retidvendedor, nombre, porcentajecomision, zona)values('001','Luis Meza','0.o2] '> ; '> [retidvendedor, nombre, porcentajecomision, zona)values('001','Luis Meza','0.o2]> -> select * from cliente; 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 '[retidvendedor, nombre, porcentajecomision, zona)values('001','Luis Meza','0....' at line 1 MariaDB [reto2]> select * from cliente; +-----------+----------------+-------------+ | idcliente | nombre | cupocredito | +-----------+----------------+-------------+ | 25147 | Teresa Su rez | 1200000 | | 36259 | Shamir Beltr n | 700000 | | 50964 | Oscar de Le n | 500000 | +-----------+----------------+-------------+ 3 rows in set (0.001 sec) MariaDB [reto2]> insert into cliente -> (idcliente, nombre, cupocredito)values('85963','Ana Valencia',1000000); Query OK, 1 row affected (0.011 sec) MariaDB [reto2]> select * from cliente; +-----------+----------------+-------------+ | idcliente | nombre | cupocredito | +-----------+----------------+-------------+ | 25147 | Teresa Su rez | 1200000 | | 36259 | Shamir Beltr n | 700000 | | 50964 | Oscar de Le n | 500000 | | 85963 | Ana Valencia | 1000000 | +-----------+----------------+-------------+ 4 rows in set (0.000 sec) MariaDB [reto2]> insert into vendedor -> -> (idvendedor, nombre, porcentajecomision, zona)values('001','Luis Meza','0.5','Norte'); Query OK, 1 row affected (0.011 sec) MariaDB [reto2]> select * from vendedor; +------------+----------------+--------------------+--------+ | idvendedor | nombre | porcentajecomision | 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.002 sec) MariaDB [reto2]> select * from vendedor where zona='norte'; +------------+-----------+--------------------+-------+ | idvendedor | nombre | porcentajecomision | zona | +------------+-----------+--------------------+-------+ | 001 | Luis Meza | 0.5 | Norte | +------------+-----------+--------------------+-------+ 1 row in set (0.001 sec) MariaDB [reto2]> select * from vendedor where zona='centro' and porcentajecomision='0.3'; +------------+----------------+--------------------+--------+ | idvendedor | nombre | porcentajecomision | zona | +------------+----------------+--------------------+--------+ | 003 | Sergio Agudelo | 0.3 | Centro | +------------+----------------+--------------------+--------+ 1 row in set (0.001 sec) MariaDB [reto2]> select * from cliente where cupocredito between 500000 and 1000000; +-----------+----------------+-------------+ | idcliente | nombre | cupocredito | +-----------+----------------+-------------+ | 36259 | Shamir Beltr n | 700000 | | 50964 | Oscar de Le n | 500000 | | 85963 | Ana Valencia | 1000000 | +-----------+----------------+-------------+ 3 rows in set (0.000 sec) MariaDB [reto2]> select * from cliente where nombre like 'a%'; +-----------+--------------+-------------+ | idcliente | nombre | cupocredito | +-----------+--------------+-------------+ | 85963 | Ana Valencia | 1000000 | +-----------+--------------+-------------+ 1 row in set (0.001 sec) MariaDB [reto2]> select * from cliente where nombre like '%a'; +-----------+--------------+-------------+ | idcliente | nombre | cupocredito | +-----------+--------------+-------------+ | 85963 | Ana Valencia | 1000000 | +-----------+--------------+-------------+ 1 row in set (0.000 sec) MariaDB [reto2]> select * from vendedor where nombre like '%a%'; +------------+----------------+--------------------+--------+ | idvendedor | nombre | porcentajecomision | 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]> select sum(cupocredito) from cliente; +------------------+ | sum(cupocredito) | +------------------+ | 3400000 | +------------------+ 1 row in set (0.001 sec) MariaDB [reto2]> select count(cupocredito) from cliente; +--------------------+ | count(cupocredito) | +--------------------+ | 4 | +--------------------+ 1 row in set (0.001 sec) MariaDB [reto2]> select avg(cupocredito) from cliente; +------------------+ | avg(cupocredito) | +------------------+ | 850000 | +------------------+ 1 row in set (0.001 sec) MariaDB [reto2]> select min(cupocredito) from cliente; +------------------+ | min(cupocredito) | +------------------+ | 500000 | +------------------+ 1 row in set (0.001 sec) MariaDB [reto2]> select max(cupocredito) from cliente; +------------------+ | max(cupocredito) | +------------------+ | 1200000 | +------------------+ 1 row in set (0.000 sec) MariaDB [reto2]> select * from cliente order by cupocredito asc; +-----------+----------------+-------------+ | idcliente | nombre | cupocredito | +-----------+----------------+-------------+ | 50964 | Oscar de Le n | 500000 | | 36259 | Shamir Beltr n | 700000 | | 85963 | Ana Valencia | 1000000 | | 25147 | Teresa Su rez | 1200000 | +-----------+----------------+-------------+ 4 rows in set (0.000 sec) MariaDB [reto2]> select * from vendedor order by nombre desc; +------------+----------------+--------------------+--------+ | idvendedor | nombre | porcentajecomision | 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.010 sec) MariaDB [reto2]> Query OK, 1 row affected (0.002 sec) -> ; 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 'Query OK, 1 row affected (0.002 sec)' at line 1 MariaDB [reto2]> select * from vendedor; +------------+----------------+--------------------+--------+ | idvendedor | nombre | porcentajecomision | 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]> exit Bye C:\xampp\mysql\bin>mysqldump -B -uroot -p