Sei sulla pagina 1di 5

Setting environment for using XAMPP for Windows.

Aula507@HOR-501-7 c:\xampp
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.1.25-MariaDB mariadb.org binary distribution

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use camilo2.0;


Database changed
MariaDB [camilo2.0]> select PRIMER_NOMBRE + '' + SEGUNDO_NOMBRE + '' +
PRIMER_APELLIDO + '' + SEGUNDO_APELLIDO as NOMBRE from personas;
+--------+
| NOMBRE |
+--------+
| 0 |
| 0 |
| NULL |
| 0 |
| 0 |
| 0 |
+--------+
6 rows in set, 41 warnings (0.02 sec)

MariaDB [camilo2.0]> select concat(PRIMER_NOMBRE , '' , SEGUNDO_NOMBRE , '' ,


PRIMER_APELLIDO '' , SEGUNDO_APELLIDO as NOMBRE from personas;
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 'from
personas' at line 1
MariaDB [camilo2.0]> select concat(PRIMER_NOMBRE , '' , SEGUNDO_NOMBRE , '' ,
PRIMER_APELLIDO '' , SEGUNDO_APELLIDO) as NOMBRE from personas;
ERROR 1583 (42000): Incorrect parameters in the call to native function 'concat'
MariaDB [camilo2.0]> select concat (PRIMER_NOMBRE , '' , SEGUNDO_NOMBRE , '' ,
PRIMER_APELLIDO '' , SEGUNDO_APELLIDO) as NOMBRE from personas;
ERROR 1583 (42000): Incorrect parameters in the call to native function 'concat'
MariaDB [camilo2.0]> select concat (PRIMER_NOMBRE , '' , SEGUNDO_NOMBRE , '' ,
PRIMER_APELLIDO, '' , SEGUNDO_APELLIDO) as NOMBRE from personas;
+----------------------------+
| NOMBRE |
+----------------------------+
| NicolMarcelaPerezRoja |
| HeiderCamiloRojasPinilla |
| NULL |
| JulianAlejandroRojasSierra |
| JulioArmandoReinaRodriguez |
| AndresFelipeRojasRomero |
+----------------------------+
6 rows in set (0.00 sec)

MariaDB [camilo2.0]> select concat (PRIMER_NOMBRE , ' ' , SEGUNDO_NOMBRE , ' ' ,
PRIMER_APELLIDO, ' ' , SEGUNDO_APELLIDO) as NOMBRE from personas;
+----------------------------------+
| NOMBRE |
+----------------------------------+
| Nicol Marcela Perez Roja |
| Heider Camilo Rojas Pinilla |
| NULL |
| Julian Alejandro Rojas Sierra |
| Julio Armando Reina Rodriguez |
| Andres Felipe Rojas Romero |
+----------------------------------+
6 rows in set (0.00 sec)

MariaDB [camilo2.0]> select concat (PRIMER_NOMBRE , ' ' , SEGUNDO_NOMBRE , ' ' ,
PRIMER_APELLIDO, ' ' , SEGUNDO_APELLIDO) as NOMBRE from personas;
+--------------------------------+
| NOMBRE |
+--------------------------------+
| Nicol Marcela Perez Roja |
| Heider Camilo Rojas Pinilla |
| NULL |
| Julian Alejandro Rojas Sierra |
| Julio Armando Reina Rodriguez |
| Andres Felipe Rojas Romero |
+--------------------------------+
6 rows in set (0.00 sec)

MariaDB [camilo2.0]> select concat (PRIMER_NOMBRE , ' ' , SEGUNDO_NOMBRE , ' ' ,
PRIMER_APELLIDO, ' ' , SEGUNDO_APELLIDO) as NOMBRE from personas;
+-------------------------------+
| NOMBRE |
+-------------------------------+
| Nicol Marcela Perez Roja |
| Heider Camilo Rojas Pinilla |
| NULL |
| Julian Alejandro Rojas Sierra |
| Julio Armando Reina Rodriguez |
| Andres Felipe Rojas Romero |
+-------------------------------+
6 rows in set (0.00 sec)

MariaDB [camilo2.0]> select *from personas;


+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
| DOCUMENTO | PRIMER_NOMBRE | SEGUNDO_NOMBRE | PRIMER_APELLIDO | SEGUNDO_APELLIDO
| USUARIO | clave |
+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
| 77785963 | Nicol | Marcela | Perez | Roja
| LAale52 | aleja1234 |
| 78963245 | Heider | Camilo | Rojas | Pinilla
| pinillaL78 | hcrp45 |
| 475896465 | Cristian | NULL | Perez | Roa
| roa145 | perez1234 |
| 587986541 | Julian | Alejandro | Rojas | Sierra
| juli8922 | julian2304 |
| 789523145 | Julio | Armando | Reina | Rodriguez
| juliosito79 | rodriguexXD |
| 1000145789 | Andres | Felipe | Rojas | Romero
| pepedias34 | pepe1234 |
+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
6 rows in set (0.00 sec)
MariaDB [camilo2.0]> select *from personas;
+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
| DOCUMENTO | PRIMER_NOMBRE | SEGUNDO_NOMBRE | PRIMER_APELLIDO | SEGUNDO_APELLIDO
| USUARIO | clave |
+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
| 77785963 | Nicol | Marcela | Perez | Roja
| LAale52 | aleja1234 |
| 78963245 | Heider | Camilo | Rojas | Pinilla
| pinillaL78 | hcrp45 |
| 475896465 | Cristian | NULL | Perez | Roa
| roa145 | perez1234 |
| 587986541 | Julian | Alejandro | Rojas | Sierra
| juli8922 | julian2304 |
| 789523145 | Julio | Armando | Reina | Rodriguez
| juliosito79 | rodriguexXD |
| 1000145789 | Andres | Felipe | Rojas | Romero
| pepedias34 | pepe1234 |
+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
6 rows in set (0.00 sec)

MariaDB [camilo2.0]> select DOCUMENTO,PRIMER_NOMBRE from personas union select


DOCUMENTO,PUNTOS_NO_REDIMIDOS from cliente;
+------------+---------------+
| DOCUMENTO | PRIMER_NOMBRE |
+------------+---------------+
| 77785963 | Nicol |
| 78963245 | Heider |
| 475896465 | Cristian |
| 587986541 | Julian |
| 789523145 | Julio |
| 1000145789 | Andres |
| 77785963 | 230 |
| 78963245 | 1000 |
| 1000145789 | 30 |
+------------+---------------+
9 rows in set (0.03 sec)

MariaDB [camilo2.0]> select DOCUMENTO,PRIMER_NOMBRE from personas join select


DOCUMENTO,PUNTOS_NO_REDIMIDOS 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 'select
DOCUMENTO,PUNTOS_NO_REDIMIDOS from cliente' at line 1
MariaDB [camilo2.0]> select DOCUMENTO,PRIMER_NOMBRE from personas inner join select
DOCUMENTO,PUNTOS_NO_REDIMIDOS 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 'select
DOCUMENTO,PUNTOS_NO_REDIMIDOS from cliente' at line 1
MariaDB [camilo2.0]> select *from personas;
+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
| DOCUMENTO | PRIMER_NOMBRE | SEGUNDO_NOMBRE | PRIMER_APELLIDO | SEGUNDO_APELLIDO
| USUARIO | clave |
+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
| 77785963 | Nicol | Marcela | Perez | Roja
| LAale52 | aleja1234 |
| 78963245 | Heider | Camilo | Rojas | Pinilla
| pinillaL78 | hcrp45 |
| 475896465 | Cristian | NULL | Perez | Roa
| roa145 | perez1234 |
| 587986541 | Julian | Alejandro | Rojas | Sierra
| juli8922 | julian2304 |
| 789523145 | Julio | Armando | Reina | Rodriguez
| juliosito79 | rodriguexXD |
| 1000145789 | Andres | Felipe | Rojas | Romero
| pepedias34 | pepe1234 |
+------------+---------------+----------------+-----------------+------------------
+-------------+-------------+
6 rows in set (0.00 sec)

MariaDB [camilo2.0]> SLECT COUNT (PRIMER_NOMBRE),DOCUMENTO from personas group by


1;
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 'SLECT
COUNT (PRIMER_NOMBRE),DOCUMENTO from personas group by 1' at line 1
MariaDB [camilo2.0]> SLECT COUNT (PRIMER_NOMBRE),DOCUMENTO,PRIMER_NOMBRE from
personas group by 3 group by 2 asc;
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 'SLECT
COUNT (PRIMER_NOMBRE),DOCUMENTO,PRIMER_NOMBRE from personas group by 3 gro' at line
1
MariaDB [camilo2.0]> SELECT COUNT (PRIMER_NOMBRE),DOCUMENTO,PRIMER_NOMBRE from
personas group by 3 group by 2 asc;
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 'group
by 2 asc' at line 1
MariaDB [camilo2.0]> SELECT COUNT (PRIMER_NOMBRE),DOCUMENTO,PRIMER_NOMBRE from
personas group by 3, group by 2 asc;
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 'group
by 2 asc' at line 1
MariaDB [camilo2.0]> select count(PRIMER_NOMBRE),DOCUMENTO,PRIMER_NOMBRE from
personas group by 3, group by 2 asc;
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 'group
by 2 asc' at line 1
MariaDB [camilo2.0]> select count(PRIMER_NOMBRE),DOCUMENTO,PRIMER_NOMBRE from
personas group by 3 group by 2 asc;
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 'group
by 2 asc' at line 1
MariaDB [camilo2.0]> select count(PRIMER_NOMBRE),DOCUMENTO,PRIMER_NOMBRE from
personas group by 3 order by 2 asc;
+----------------------+------------+---------------+
| count(PRIMER_NOMBRE) | DOCUMENTO | PRIMER_NOMBRE |
+----------------------+------------+---------------+
| 1 | 77785963 | Nicol |
| 1 | 78963245 | Heider |
| 1 | 475896465 | Cristian |
| 1 | 587986541 | Julian |
| 1 | 789523145 | Julio |
| 1 | 1000145789 | Andres |
+----------------------+------------+---------------+
6 rows in set (0.00 sec)
MariaDB [camilo2.0]>

Potrebbero piacerti anche