Solved

My SQL Database creation error

Posted on 2013-01-13
1
248 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 500 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

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…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

751 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