Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Dúvida no Ex. 4 da Aula 1 - Consultando os dados

Estou com problema para importar o arquivo baixado, solicito ajuda com este erro:

mysql> DESC COMPRAS;
+-------------+--------------+------+-----+---------+----------------+
| Field       | Type         | Null | Key | Default | Extra          |
+-------------+--------------+------+-----+---------+----------------+
| id          | int(11)      | NO   | PRI | NULL    | auto_increment |
| valor       | double       | YES  |     | NULL    |                |
| data        | date         | YES  |     | NULL    |                |
| descricao   | varchar(255) | YES  |     | NULL    |                |
| observacoes | varchar(255) | YES  |     | NULL    |                |
| recebido    | tinyint(1)   | YES  |     | NULL    |                |
+-------------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> select * from COMPRAS;
Empty set (0.00 sec)

mysql> mysql -u root -p controle_compras < cap2.sql
    -> select * from COMPRAS;
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 'mysql -u root -p controle_compras < cap2.sql
select * from COMPRAS' at line 1
mysql>
2 respostas
solução!

Bom dia Charles tente o seguinte algorítimo. Faça login no mysql

mysql -u root //-p caso tenha senha 

use database_queQuiser

source /home/usuario/arquivo.sql;

esse é um comando mais simplificado!

;)

Obrigado Douglas! segue o resultado...

mysql> source C:/ProgramData/Microsoft/Windows/Start Menu/Programs/MySQL/MySQL Server 5.7/cap2.sql;
Query OK, 1 row affected (0.15 sec)

Query OK, 1 row affected (0.05 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.08 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.09 sec)

Query OK, 1 row affected (0.09 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.05 sec)

Query OK, 1 row affected (0.02 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.05 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.13 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.05 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.05 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.05 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.06 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.05 sec)

Query OK, 1 row affected (0.02 sec)

Query OK, 1 row affected (0.04 sec)

Query OK, 1 row affected (0.03 sec)

Query OK, 1 row affected (0.07 sec)

mysql>