0

First and foremost, I am a total novice when it comes to SQL, and I'm trying to build a database for my web design course. Having tried a thorough google search and exploring some of the answers here, I'm still no closer to figuring out what my problem is. The error that keeps getting thrown out is the title of this question, but this is the code I have so far:

Table structure for table `members`

create database glasgowboys;
use glasgowboys;

CREATE TABLE `members` 
(`ID` int(11) NOT NULL AUTO_INCREMENT,
`Email` varchar(255) NOT NULL,
`Password` varchar(50) NOT NULL,
`FirstName` varchar(255) NOT NULL,
`LastName` varchar(255) NOT NULL,) 
ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

I've been through several similar questions on stackoverflow, following their advice on replacing quotes with backticks, but with no luck.

1
  • No wonder you didn't find relevant answers here. "Spell-check this for me" kind of questions are a horrible fit for a Q&A site like Stack Overflow. Most likely, your question will not help anyone else in the future either. Commented Jan 15, 2014 at 11:58

2 Answers 2

1

When using auto_increment, make the field primary key. Also, remove the extra , after the last field definition.

Try this:

CREATE TABLE `members` 
(`ID` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`Email` varchar(255) NOT NULL,
`Password` varchar(50) NOT NULL,
`FirstName` varchar(255) NOT NULL,
`LastName` varchar(255) NOT NULL) 
ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Sign up to request clarification or add additional context in comments.

1 Comment

Well, that cleared the error - now I'm getting another one! Hopefully I'll be able to figure the rest out :) Many thanks.
0

Around table or field names, you must put "[]", not "'" and certainly not "`".

This should be

CREATE TABLE members
([ID] int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
[Email] varchar(255) NOT NULL,
[Password] varchar(50) NOT NULL,
[FirstName] varchar(255) NOT NULL,
[LastName] varchar(255) NOT NULL) 
ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

(Maybe still not exactly correct, I only have Sql Server for testing around just now)

1 Comment

I tried this but it threw out the same error as before - unfortunately I'm going to have to fix the new error before I find out if this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.