Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7568981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:03:58+00:00 2026-05-30T15:03:58+00:00

Trying to create a few new tables with foreign keys but am getting caught

  • 0

Trying to create a few new tables with foreign keys but am getting caught up, here’s the code and the error I’m receiving, I think it has something to
do with my foreign key?

#1064 - You have an error in your SQL syntax;
    check the manual that corresponds to your MySQL server version for the
    right syntax to use near '(`CustomerID`),
    ) ENGINE=InnoDB DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1' at line 10



DROP TABLE IF EXISTS `Customer`;
CREATE TABLE `Customer` (

    `CustomerID`            INT UNSIGNED AUTO_INCREMENT, 
    `Customer_Number`       VARCHAR(100), 
    `Customer_Name`         VARCHAR(100), 
    `Website`               VARCHAR(255), 
    `Logo`                  VARCHAR(100),

    PRIMARY KEY(`CustomerID`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1;


    DROP TABLE IF EXISTS `Reports`;
    CREATE TABLE `Reports` (

        `ReportsID`             INT UNSIGNED AUTO_INCREMENT, 
        `Role`                  VARCHAR(70), 
        `Region`                VARCHAR(70), 
        `Inpection_Type`        VARCHAR(70), 
        `CustomerID`            INT UNSIGNED,
        `Report_Date`           DATE NOT NULL DEFAULT '0000-00-00',
        `Order_Date`            TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
        `Customer_Name`         VARCHAR(100),
        `Customer_Division`     VARCHAR(70),
        `Memo`                  VARCHAR(255),
        `Billing_Key`           VARCHAR(70),

        PRIMARY KEY(`ReportsID`),
        FOREIGN KEY (`CustomerID`) REFERENCES Customer(`CustomerID`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1;

    DROP TABLE IF EXISTS `CustomerContact`;
    CREATE TABLE `CustomerContact` (

        `ContactID`             INT UNSIGNED AUTO_INCREMENT,
        `CustomerID`            INT UNSIGNED,
        `Division`              VARCHAR(100), 
        `Contact`               VARCHAR(100), 
        `Address`               VARCHAR(255),
        `Phone`                 VARCHAR(100),
        `Fax`                   VARCHAR(100),
        `Email`                 VARCHAR(100),
        `Mobile`                VARCHAR(100),

        PRIMARY KEY(`ContactID`),
        FOREIGN KEY (`CustomerID) REFERENCES Customer(`CustomerID`) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T15:03:59+00:00Added an answer on May 30, 2026 at 3:03 pm

    You’ve got a missing comma after the Logo column, and a missing backtick at the end of the CustomerID column name in the foreign key definition.

    Once you fix those and re-run the DDL you will discover that the CustomerContact table does not have a column named CustomerID, so you should add that, too.

      DROP TABLE IF EXISTS `Customer`;
        CREATE TABLE `Customer` ( 
            `CustomerID`            INT UNSIGNED AUTO_INCREMENT,
            `Customer_Number`        VARCHAR(100),
            `Customer_Name`            VARCHAR(100),
            `Website`                VARCHAR(255),
            `Logo`                    VARCHAR(100),
            PRIMARY KEY(`CustomerID`)
        ) ENGINE=InnoDB DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1;
    
    
        DROP TABLE IF EXISTS `CustomerContact`;
        CREATE TABLE `CustomerContact` (
    
            `ContactID`                INT UNSIGNED AUTO_INCREMENT,
            `Division`                VARCHAR(100),
            `Contact`                VARCHAR(100),
            `Address`                VARCHAR(255),
            `Phone`                    VARCHAR(100),
            `Fax`                    VARCHAR(100),
            `Email`                    VARCHAR(100),
            `Mobile`                VARCHAR(100),
            PRIMARY KEY(`ContactID`),
            CONSTRAINT FOREIGN KEY (`CustomerID`) REFERENCES Customer(`CustomerID`) ON DELETE CASCADE ON UPDATE CASCADE
        ) ENGINE=InnoDB DEFAULT CHARSET=UTF8 AUTO_INCREMENT=1;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm just trying to create a new MySQL database with a few simple tables.
Trying to create a user account in a test. But getting a Object reference
What i'm trying to create is a background worker that executes a few processes
I'm trying to learn JavaFX and maybe create a few learner games. I always
Ok so I am trying create a login script, here I am using PHP5
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
I'm trying to create a quick piece of code to capture the key sequence
i am new to opengl es 2.0 on ios, i am trying to create
I'm trying to create a model which is a hashtable with a few accessor
i'm trying to create a simple program that will upload a few files for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.