Está en la página 1de 11

Setting environment for using XAMPP for Windows.

Laraa@MATISS c:\xampp
# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.4.27-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 futbol;


Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> show databases;


+----------------------+
| Database |
+----------------------+
| cita |
| contactos |
| dbcinemax |
| escuela |
| familia |
| futbol |
| informacion_personal |
| information_schema |
| mysql |
| performance_schema |
| phpmyadmin |
| test |
| tienda |
| vehiculos |
+----------------------+
14 rows in set (0.001 sec)

MariaDB [(none)]> use futbol;


Database changed
MariaDB [futbol]> create table jugador
-> (RFC int not null auto_increment,
-> APaterno varchar(30),
-> nombre varchar(30),
-> fechaNac date,
-> noCel varchar(30),
-> EQUIPO int,
-> POSICION int,
-> primary key (RFC));
Query OK, 0 rows affected (0.019 sec)

MariaDB [futbol]> create table equipo


-> (IDequipo int not null auto_increment,
-> nombre varchar(30),
-> logo blob,
-> primary key (IDequipo));
Query OK, 0 rows affected (0.024 sec)

MariaDB [futbol]> create table posicion


-> (IDposicion int not null auto_increment,
-> descripcion varchar(30),
-> primary key (IDposicion));
Query OK, 0 rows affected (0.018 sec)

MariaDB [futbol]> show tables;


+------------------+
| Tables_in_futbol |
+------------------+
| equipo |
| jugador |
| posicion |
+------------------+
3 rows in set (0.001 sec)

MariaDB [futbol]> select * from equipo;


Empty set (0.001 sec)

MariaDB [futbol]> describe equipo;


+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| IDequipo | int(11) | NO | PRI | NULL | auto_increment |
| nombre | varchar(30) | YES | | NULL | |
| logo | blob | YES | | NULL | |
+----------+-------------+------+-----+---------+----------------+
3 rows in set (0.023 sec)

MariaDB [futbol]> insert into equipo


-> values
-> ('1','barcelona','1');
Query OK, 1 row affected (0.012 sec)

MariaDB [futbol]> select * from equipo;


+----------+-----------+------+
| IDequipo | nombre | logo |
+----------+-----------+------+
| 1 | barcelona | 1 |
+----------+-----------+------+
1 row in set (0.000 sec)

MariaDB [futbol]> insert into equipo


-> (IDequipo, nombre, logo)
-> values
-> ('2','psg','2');
Query OK, 1 row affected (0.002 sec)

MariaDB [futbol]> select * from equipo;


+----------+-----------+------+
| IDequipo | nombre | logo |
+----------+-----------+------+
| 1 | barcelona | 1 |
| 2 | psg | 2 |
+----------+-----------+------+
2 rows in set (0.000 sec)

MariaDB [futbol]> show tables;


+------------------+
| Tables_in_futbol |
+------------------+
| equipo |
| jugador |
| posicion |
+------------------+
3 rows in set (0.001 sec)

MariaDB [futbol]> describe jugador;


+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| RFC | int(11) | NO | PRI | NULL | auto_increment |
| APaterno | varchar(30) | YES | | NULL | |
| nombre | varchar(30) | YES | | NULL | |
| fechaNac | date | YES | | NULL | |
| noCel | varchar(30) | YES | | NULL | |
| EQUIPO | int(11) | YES | | NULL | |
| POSICION | int(11) | YES | | NULL | |
+----------+-------------+------+-----+---------+----------------+
7 rows in set (0.026 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ('270104','padilla','daniel','2004/01/27','7717017664','7','delantero');
Query OK, 1 row affected, 1 warning (0.012 sec)

MariaDB [futbol]> select * from jugador;


+--------+----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+--------+----------+--------+------------+------------+--------+----------+
| 270104 | padilla | daniel | 2004-01-27 | 7717017664 | 7 | 0 |
+--------+----------+--------+------------+------------+--------+----------+
1 row in set (0.000 sec)

MariaDB [futbol]> update jugador set equipo='1' where RFC='270104';


Query OK, 1 row affected (0.002 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [futbol]> select * from jugador;


+--------+----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+--------+----------+--------+------------+------------+--------+----------+
| 270104 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 0 |
+--------+----------+--------+------------+------------+--------+----------+
1 row in set (0.001 sec)

MariaDB [futbol]> update jugador set RFC='1' where EQUIPO='1';


Query OK, 1 row affected (0.012 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [futbol]> select * from jugador;


+-----+----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 0 |
+-----+----------+--------+------------+------------+--------+----------+
1 row in set (0.001 sec)

MariaDB [futbol]> update jugador set POSICION='1' where RFC='1';


Query OK, 1 row affected (0.012 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [futbol]> select * from jugador;


+-----+----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
+-----+----------+--------+------------+------------+--------+----------+
1 row in set (0.001 sec)

MariaDB [futbol]> show tables;


+------------------+
| Tables_in_futbol |
+------------------+
| equipo |
| jugador |
| posicion |
+------------------+
3 rows in set (0.001 sec)

MariaDB [futbol]> select * from equipo;


+----------+-----------+------+
| IDequipo | nombre | logo |
+----------+-----------+------+
| 1 | barcelona | 1 |
| 2 | psg | 2 |
+----------+-----------+------+
2 rows in set (0.000 sec)

MariaDB [futbol]> select * from jugador;


+-----+----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
+-----+----------+--------+------------+------------+--------+----------+
1 row in set (0.001 sec)

MariaDB [futbol]> select * from posicion;


Empty set (0.001 sec)

MariaDB [futbol]> describe posicion;


+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+
| IDposicion | int(11) | NO | PRI | NULL | auto_increment |
| descripcion | varchar(30) | YES | | NULL | |
+-------------+-------------+------+-----+---------+----------------+
2 rows in set (0.029 sec)

MariaDB [futbol]> insert into posicion


-> values
-> ('1','delantero');
Query OK, 1 row affected (0.011 sec)

MariaDB [futbol]> insert into posicion


-> (IDposicion, descripcion)
-> values
-> ('2','defensa');
Query OK, 1 row affected (0.039 sec)
MariaDB [futbol]> insert into posicion
-> values
-> ('3','portero');
Query OK, 1 row affected (0.012 sec)

MariaDB [futbol]> select * from posicion;


+------------+-------------+
| IDposicion | descripcion |
+------------+-------------+
| 1 | delantero |
| 2 | defensa |
| 3 | portero |
+------------+-------------+
3 rows in set (0.000 sec)

MariaDB [futbol]> show tables;


+------------------+
| Tables_in_futbol |
+------------------+
| equipo |
| jugador |
| posicion |
+------------------+
3 rows in set (0.001 sec)

MariaDB [futbol]> select * from equipo;


+----------+-----------+------+
| IDequipo | nombre | logo |
+----------+-----------+------+
| 1 | barcelona | 1 |
| 2 | psg | 2 |
+----------+-----------+------+
2 rows in set (0.001 sec)

MariaDB [futbol]> select * from jugador;


+-----+----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
+-----+----------+--------+------------+------------+--------+----------+
1 row in set (0.001 sec)

MariaDB [futbol]> select * from posicion;


+------------+-------------+
| IDposicion | descripcion |
+------------+-------------+
| 1 | delantero |
| 2 | defensa |
| 3 | portero |
+------------+-------------+
3 rows in set (0.001 sec)

MariaDB [futbol]> alter table jugador


-> add constraint fk_equipo
-> foreign key (EQUIPO) references equipo (IDequipo);
Query OK, 1 row affected (0.053 sec)
Records: 1 Duplicates: 0 Warnings: 0
MariaDB [futbol]> describe jugador;
+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| RFC | int(11) | NO | PRI | NULL | auto_increment |
| APaterno | varchar(30) | YES | | NULL | |
| nombre | varchar(30) | YES | | NULL | |
| fechaNac | date | YES | | NULL | |
| noCel | varchar(30) | YES | | NULL | |
| EQUIPO | int(11) | YES | MUL | NULL | |
| POSICION | int(11) | YES | | NULL | |
+----------+-------------+------+-----+---------+----------------+
7 rows in set (0.020 sec)

MariaDB [futbol]> alter table jugador


-> add constrain fk_jugador,
-> foreign key(jugador) references posicion (IDposicion);
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 '
foreign key(jugador) references posicion (IDposicion)' at line 2
MariaDB [futbol]> alter table jugador
-> add constraint fk_posicion
-> foreign key (POSICION) references posicion (IDposicion);
Query OK, 1 row affected (0.046 sec)
Records: 1 Duplicates: 0 Warnings: 0

MariaDB [futbol]> select * from jugador;


+-----+----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
+-----+----------+--------+------------+------------+--------+----------+
1 row in set (0.001 sec)

MariaDB [futbol]> describe jugador;


+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| RFC | int(11) | NO | PRI | NULL | auto_increment |
| APaterno | varchar(30) | YES | | NULL | |
| nombre | varchar(30) | YES | | NULL | |
| fechaNac | date | YES | | NULL | |
| noCel | varchar(30) | YES | | NULL | |
| EQUIPO | int(11) | YES | MUL | NULL | |
| POSICION | int(11) | YES | MUL | NULL | |
+----------+-------------+------+-----+---------+----------------+
7 rows in set (0.017 sec)

MariaDB [futbol]> describe jugador;


+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| RFC | int(11) | NO | PRI | NULL | auto_increment |
| APaterno | varchar(30) | YES | | NULL | |
| nombre | varchar(30) | YES | | NULL | |
| fechaNac | date | YES | | NULL | |
| noCel | varchar(30) | YES | | NULL | |
| EQUIPO | int(11) | YES | MUL | NULL | |
| POSICION | int(11) | YES | MUL | NULL | |
+----------+-------------+------+-----+---------+----------------+
7 rows in set (0.018 sec)

MariaDB [futbol]> select * from jugador;


+-----+----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
+-----+----------+--------+------------+------------+--------+----------+
1 row in set (0.001 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ('2', 'hernandez', 'jose','2005/04/23','7712177927', '1', '1');
Query OK, 1 row affected (0.017 sec)

MariaDB [futbol]> select * from jugador;


+-----+-----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+-----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
| 2 | hernandez | jose | 2005-04-23 | 7712177927 | 1 | 1 |
+-----+-----------+--------+------------+------------+--------+----------+
2 rows in set (0.000 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ;
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 [futbol]> show tables;
+------------------+
| Tables_in_futbol |
+------------------+
| equipo |
| jugador |
| posicion |
+------------------+
3 rows in set (0.001 sec)

MariaDB [futbol]> select * from jugador;


+-----+-----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+-----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
| 2 | hernandez | jose | 2005-04-23 | 7712177927 | 1 | 1 |
+-----+-----------+--------+------------+------------+--------+----------+
2 rows in set (0.000 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ('3', 'hernandez', 'marcos','2004/12/01','7712976220', '1', '1');
Query OK, 1 row affected (0.012 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ('4', 'hernandez', 'julian','2000/04/13','7711406222', '1', '3');
Query OK, 1 row affected (0.012 sec)
MariaDB [futbol]> select * from jugador;
+-----+-----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+-----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
| 2 | hernandez | jose | 2005-04-23 | 7712177927 | 1 | 1 |
| 3 | hernandez | marcos | 2004-12-01 | 7712976220 | 1 | 1 |
| 4 | hernandez | julian | 2000-04-13 | 7711406222 | 1 | 3 |
+-----+-----------+--------+------------+------------+--------+----------+
4 rows in set (0.000 sec)

MariaDB [futbol]> update jugador set POSICION='2' where RFC='3';


Query OK, 1 row affected (0.012 sec)
Rows matched: 1 Changed: 1 Warnings: 0

MariaDB [futbol]> select * from jugador;


+-----+-----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+-----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
| 2 | hernandez | jose | 2005-04-23 | 7712177927 | 1 | 1 |
| 3 | hernandez | marcos | 2004-12-01 | 7712976220 | 1 | 2 |
| 4 | hernandez | julian | 2000-04-13 | 7711406222 | 1 | 3 |
+-----+-----------+--------+------------+------------+--------+----------+
4 rows in set (0.000 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ('5', 'hernandez', 'alan','2004/03/11','7710426122', '2', '1');
Query OK, 1 row affected (0.011 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ('6', 'hernandez', 'juan','2004/01/12','7714274754', '2', '1');
Query OK, 1 row affected (0.039 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ('7', 'cortes', 'santos','1990/05/07','7711223734', '2', '2');
Query OK, 1 row affected (0.012 sec)

MariaDB [futbol]> insert into jugador


-> values
-> ('8', 'martinez', 'fermin','2004/10/15','7711946239', '2', '3');
Query OK, 1 row affected (0.020 sec)

MariaDB [futbol]> select * from jugador;


+-----+-----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+-----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
| 2 | hernandez | jose | 2005-04-23 | 7712177927 | 1 | 1 |
| 3 | hernandez | marcos | 2004-12-01 | 7712976220 | 1 | 2 |
| 4 | hernandez | julian | 2000-04-13 | 7711406222 | 1 | 3 |
| 5 | hernandez | alan | 2004-03-11 | 7710426122 | 2 | 1 |
| 6 | hernandez | juan | 2004-01-12 | 7714274754 | 2 | 1 |
| 7 | cortes | santos | 1990-05-07 | 7711223734 | 2 | 2 |
| 8 | martinez | fermin | 2004-10-15 | 7711946239 | 2 | 3 |
+-----+-----------+--------+------------+------------+--------+----------+
8 rows in set (0.011 sec)

MariaDB [futbol]> show tables;


+------------------+
| Tables_in_futbol |
+------------------+
| equipo |
| jugador |
| posicion |
+------------------+
3 rows in set (0.001 sec)

MariaDB [futbol]> describe equipo;


+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| IDequipo | int(11) | NO | PRI | NULL | auto_increment |
| nombre | varchar(30) | YES | | NULL | |
| logo | blob | YES | | NULL | |
+----------+-------------+------+-----+---------+----------------+
3 rows in set (0.027 sec)

MariaDB [futbol]> describe jugador;


+----------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+----------------+
| RFC | int(11) | NO | PRI | NULL | auto_increment |
| APaterno | varchar(30) | YES | | NULL | |
| nombre | varchar(30) | YES | | NULL | |
| fechaNac | date | YES | | NULL | |
| noCel | varchar(30) | YES | | NULL | |
| EQUIPO | int(11) | YES | MUL | NULL | |
| POSICION | int(11) | YES | MUL | NULL | |
+----------+-------------+------+-----+---------+----------------+
7 rows in set (0.017 sec)

MariaDB [futbol]> describe posicion;


+-------------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+----------------+
| IDposicion | int(11) | NO | PRI | NULL | auto_increment |
| descripcion | varchar(30) | YES | | NULL | |
+-------------+-------------+------+-----+---------+----------------+
2 rows in set (0.018 sec)

MariaDB [futbol]> select * from equipo;


+----------+-----------+------+
| IDequipo | nombre | logo |
+----------+-----------+------+
| 1 | barcelona | 1 |
| 2 | psg | 2 |
+----------+-----------+------+
2 rows in set (0.000 sec)

MariaDB [futbol]> select * from jugador;


+-----+-----------+--------+------------+------------+--------+----------+
| RFC | APaterno | nombre | fechaNac | noCel | EQUIPO | POSICION |
+-----+-----------+--------+------------+------------+--------+----------+
| 1 | padilla | daniel | 2004-01-27 | 7717017664 | 1 | 1 |
| 2 | hernandez | jose | 2005-04-23 | 7712177927 | 1 | 1 |
| 3 | hernandez | marcos | 2004-12-01 | 7712976220 | 1 | 2 |
| 4 | hernandez | julian | 2000-04-13 | 7711406222 | 1 | 3 |
| 5 | hernandez | alan | 2004-03-11 | 7710426122 | 2 | 1 |
| 6 | hernandez | juan | 2004-01-12 | 7714274754 | 2 | 1 |
| 7 | cortes | santos | 1990-05-07 | 7711223734 | 2 | 2 |
| 8 | martinez | fermin | 2004-10-15 | 7711946239 | 2 | 3 |
+-----+-----------+--------+------------+------------+--------+----------+
8 rows in set (0.000 sec)

MariaDB [futbol]> select * from posicion;


+------------+-------------+
| IDposicion | descripcion |
+------------+-------------+
| 1 | delantero |
| 2 | defensa |
| 3 | portero |
+------------+-------------+
3 rows in set (0.000 sec)

MariaDB [futbol]> select jugador.nombre, equipo.nombre, posicion.descripcion from


jugador, equipo, posicion where jugador.equipo=equipo.IDequipo and
jugador.posicion=posicion.IDposicion;
+--------+-----------+-------------+
| nombre | nombre | descripcion |
+--------+-----------+-------------+
| daniel | barcelona | delantero |
| jose | barcelona | delantero |
| marcos | barcelona | defensa |
| julian | barcelona | portero |
| alan | psg | delantero |
| juan | psg | delantero |
| santos | psg | defensa |
| fermin | psg | portero |
+--------+-----------+-------------+
8 rows in set (0.001 sec)

MariaDB [futbol]> select jugador.nombre, equipo.nombre, posicion.descripcion from


jugador, equipo, posicion where jugador.equipo=equipo.IDequipo and
jugador.posicion=posicion.IDposicion and descripcion='descripcion';
Empty set (0.001 sec)

MariaDB [futbol]> select jugador.nombre, equipo.nombre, posicion.descripcion from


jugador, equipo, posicion where jugador.equipo=equipo.IDequipo and
jugador.posicion=posicion.IDposicion and descripcion='delantero';
+--------+-----------+-------------+
| nombre | nombre | descripcion |
+--------+-----------+-------------+
| daniel | barcelona | delantero |
| jose | barcelona | delantero |
| alan | psg | delantero |
| juan | psg | delantero |
+--------+-----------+-------------+
4 rows in set (0.000 sec)

MariaDB [futbol]> select jugador.nombre, equipo.nombre, posicion.descripcion from


jugador, equipo, posicion where jugador.equipo=equipo.IDequipo and
jugador.posicion=posicion.IDposicion and descripcion='1';
Empty set (0.000 sec)

MariaDB [futbol]> select jugador.nombre, equipo.nombre, posicion.descripcion from


jugador, equipo, posicion where jugador.equipo=equipo.IDequipo and
jugador.posicion=posicion.IDposicion and descripcion='delantero';
+--------+-----------+-------------+
| nombre | nombre | descripcion |
+--------+-----------+-------------+
| daniel | barcelona | delantero |
| jose | barcelona | delantero |
| alan | psg | delantero |
| juan | psg | delantero |
+--------+-----------+-------------+
4 rows in set (0.000 sec)

MariaDB [futbol]> select jugador.nombre, equipo.nombre, posicion.descripcion from


jugador, equipo, posicion where jugador.equipo=equipo.IDequipo and
jugador.posicion=posicion.IDposicion and descripcion='defensa';
+--------+-----------+-------------+
| nombre | nombre | descripcion |
+--------+-----------+-------------+
| marcos | barcelona | defensa |
| santos | psg | defensa |
+--------+-----------+-------------+
2 rows in set (0.000 sec)

MariaDB [futbol]> select jugador.nombre, equipo.nombre, posicion.descripcion from


jugador, equipo, posicion where jugador.equipo=equipo.IDequipo and
jugador.posicion=posicion.IDposicion and descripcion='portero';
+--------+-----------+-------------+
| nombre | nombre | descripcion |
+--------+-----------+-------------+
| julian | barcelona | portero |
| fermin | psg | portero |
+--------+-----------+-------------+
2 rows in set (0.000 sec)

MariaDB [futbol]> select jugador.nombre, equipo.nombre, posicion.descripcion from


jugador, equipo, posicion where jugador.equipo=equipo.IDequipo and
jugador.posicion=posicion.IDposicion;
+--------+-----------+-------------+
| nombre | nombre | descripcion |
+--------+-----------+-------------+
| daniel | barcelona | delantero |
| jose | barcelona | delantero |
| marcos | barcelona | defensa |
| julian | barcelona | portero |
| alan | psg | delantero |
| juan | psg | delantero |
| santos | psg | defensa |
| fermin | psg | portero |
+--------+-----------+-------------+
8 rows in set (0.000 sec)

MariaDB [futbol]>

También podría gustarte