Help with SQL error 1064

Asked

Viewed 6,656 times

0

Could you help me solve this problem here?

use bancoteste:
create TABLE login{nome varchar(10),senha varchar(10));
INSERT into login VALUES (`root´,`root´);
SELECT * from login

Error:

SQL Error (1064): 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 ': create TABLE login{name varchar(10),password varchar(10))' at line 1

  • You put two dots in front of the "bancoteste" place semicolon

2 answers

4

There are 3 problems with the commands you indicated in your question:

1. Two dots instead of a semicolon on:

use bancoteste:

2. Keychain ({) instead of parentheses (() in:

create TABLE login{nome varchar(10),senha varchar(10));

3. Invalid characters when defining a text in:

INSERT into login VALUES (´root´,´root´);


Queries correct and structured:

USE bancoteste;

CREATE TABLE login
(
        nome    VARCHAR(10)
    ,   senha   VARCHAR(10)
);

INSERT INTO login 
VALUES ('root', 'root');

SELECT  * 
FROM    login;

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.