Solved

My SQL Database creation error

Posted on 2013-01-13
1
238 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
1 Comment
 
LVL 24

Accepted Solution

by:
johanntagle earned 500 total points
Comment Utility
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now