TheGame
TheGame

Reputation: 17

Error in importing sql file [#1064]

I am trying to create a database for my login/signup forms. I creted this database using SQL. However, when importing it in phpmyadmin it says "Import has been successfully finished, 5 queries executed." then the error: Error

SQL query:

CREATE TABLE if not exists LoginTable(

  name varchar(100) not null,

  email varchar(100) not null default "",

  password varchar(50) not null default "", 

  age integer(50) not null,

  primary key ('email', 'password') 

)

MySQL said: Documentation

#1064 - 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 ''email', 'password') )' at line 7

this is my sql code:

drop database if exists loginInfo;
create database if not exists loginInfo;
use loginInfo;

drop table if exists LoginTable;

CREATE TABLE if not exists LoginTable(

    name varchar(100) not null,
    email varchar(100) not null,
    password varchar(50) not null,   
    age integer(50) not null,
    primary key ('email', 'password') 
);

Upvotes: 0

Views: 870

Answers (1)

gowthami srinivasan
gowthami srinivasan

Reputation: 36

Remove Single quotes in email, password.

While defining primary key you don't need to add quotes.

drop database if exists loginInfo;
create database if not exists loginInfo;
use loginInfo;

drop table if exists LoginTable;

CREATE TABLE if not exists LoginTable(
    name varchar(100) not null,
    email varchar(100) not null,
    password varchar(50) not null,   
    age integer(50) not null,
    primary key (email, password)
);

Upvotes: 2

Related Questions