0% found this document useful (0 votes)
59 views3 pages

Consultas Mysql

The document shows the output of various SQL commands run in a MySQL database called venta. It shows the tables in the database, performs some SELECT queries to view data from different tables, loads data from files into new tables called uno and dos, and performs some JOIN queries on the tables.

Uploaded by

Arael Gonzalez
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views3 pages

Consultas Mysql

The document shows the output of various SQL commands run in a MySQL database called venta. It shows the tables in the database, performs some SELECT queries to view data from different tables, loads data from files into new tables called uno and dos, and performs some JOIN queries on the tables.

Uploaded by

Arael Gonzalez
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g.

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>

You might also like