?
Solved

My SQL Database creation error

Posted on 2013-01-13
1
Medium Priority
?
251 Views
Last Modified: 2013-01-14
I am learning to write sql scripts and I am getting the following error and I am not sure why?

      ERROR 1064 (42000): You have an error in your SQL syntax;

  The script (attached is very simple).  I ran a similar script from my text and had no issues.  But when I tried to edit the script for my purposes I keep getting this error.  My script and a screen shot of the error are attached.
Bookmark.sql
Database-Creation-Error.docx
0
Comment
Question by:Genus1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 24

Accepted Solution

by:
johanntagle earned 2000 total points
ID: 38772922
You need to remove the final comma before the closing parenthesis in the table creation statements.  They should be:

CREATE TABLE Users
(
   UserID int NOT NULL AUTO_INCREMENT PRIMARY KEY,
   Firstname varchar(20) NOT NULL,
   Lastname varchar(20) NOT NULL,
   EmailAddress varchar(20) NOT NULL,
   Username varchar(20) NOT NULL,
   Password varchar(20) NOT NULL
);

CREATE TABLE Urls
(
   UserID int NOT NULL,
   URL varchar(45) NOT NULL,
   FOREIGN KEY (UserID) REFERENCES Users(UserID)
);  

Open in new window

0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question