Consultas Mysql
Consultas Mysql
Consultas Mysql
Your MySQL connection id is 7 Server version: 5.0.85-community-nt MySQL Community Edition (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> use venta; Database changed mysql> show tables; +-----------------+ Tables_in_venta +-----------------+ alumno familia platillo sueldo ventas +-----------------+ 5 rows in set (0.00 sec) mysql> select * from familia; +---------+------+ nombre edad +---------+------+ karina 20 armando 45 oscar 30 +---------+------+ 3 rows in set (0.01 sec) mysql> select * from sueldo where =( -> select nombre from platillo where platillo = "tacos"); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=( select nombre from platillo where platillo = "tacos")' at line 1 mysql> select * from platillo; +---------+---------------+ nombre pliatillo +---------+---------------+ tacos rmando hamburguesas oscar spagetti +---------+---------------+ 3 rows in set (0.00 sec) mysql> create table uno (codigo int (1), nombre varchar (15)); Query OK, 0 rows affected (0.07 sec) mysql> create table dos (codigo int (1), nombre varchar (15)); Query OK, 0 rows affected (0.02 sec) mysql> show tables; +-----------------+ Tables_in_venta +-----------------+ alumno dos familia platillo
sueldo uno ventas +-----------------+ 7 rows in set (0.00 sec) mysql> load data local infile "/uno.txt" into table; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 mysql> load data local infile"/uno.txt" into table uno; Query OK, 4 rows affected (0.01 sec) Records: 4 Deleted: 0 Skipped: 0 Warnings: 0 mysql> load data local infile"/dos.txt" into table dos; Query OK, 4 rows affected (0.01 sec) Records: 4 Deleted: 0 Skipped: 0 Warnings: 0 mysql> selct* from uno; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selct * from uno' at line 1 mysql> select * from uno; +--------+---------+ codigo nombre +--------+---------+ 1 perro 2 gato 3 perico 4 conejo +--------+---------+ 4 rows in set (0.00 sec) mysql> select * from dos; +--------+------------+ codigo nombre +--------+------------+ 1 perro 2 elefante 3 serpiente 4 conejo +--------+------------+ 4 rows in set (0.00 sec) mysql> select *from uno inner join dos; +--------+---------+--------+------------+ codigo nombre codigo nombre +--------+---------+--------+------------+ 1 perro 1 perro 1 perro 1 perro 2 elefante 2 elefante 2 elefante 2 elefante 3 serpiente 3 serpiente 3 serpiente 3 serpiente
conejo conejo 4 conejo 4 conejo +--------+---------+--------+------------+ 16 rows in set (0.00 sec) 4 mysql> select *from uno inner join dos on uno.codigo = dos.codigo; +--------+---------+--------+------------+ codigo nombre codigo nombre +--------+---------+--------+------------+ 1 perro 2 elefante 3 serpiente 4 conejo +--------+---------+--------+------------+ 4 rows in set (0.00 sec) mysql> select *from uno inner join dos on uno.nombre = dos.nombre; +--------+--------+--------+--------+ codigo nombre codigo nombre +--------+--------+--------+--------+ 1 perro +--------+--------+--------+--------+ 1 row in set (0.00 sec) mysql> select *from uno cross join dos; +--------+---------+--------+------------+ codigo nombre codigo nombre +--------+---------+--------+------------+ 1 perro 1 perro 1 perro 1 perro 2 elefante 2 elefante 2 elefante 2 elefante 3 serpiente 3 serpiente 3 serpiente 3 serpiente 4 conejo 4 conejo 4 conejo 4 conejo +--------+---------+--------+------------+ 16 rows in set (0.00 sec) mysql> select *from familia natural join platillo; +---------+------+---------------+ nombre edad pliatillo +---------+------+---------------+ 20 tacos rmando 45 hamburguesas oscar 30 spagetti +---------+------+---------------+ 3 rows in set (0.00 sec) mysql>