Solved

My SQL Database creation error

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySQL Error Code 2 27
CLI command keep running after close 7 56
MySQL Finding Duplicates in a Normalized Database 6 28
MySqli Real Escape String and SQL Injection 1 44
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

740 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