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 8914071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:38:24+00:00 2026-06-15T04:38:24+00:00

I am creating 3 subclass table, other 2 is done and work normally but

  • 0

I am creating 3 subclass table, other 2 is done and work normally but I get this error(1064) when I enter the following code for the last table:

mysql> CREATE TABLE foreign (
    -> account_no VARCHAR(16) NOT NULL,
    -> foreign_id VARCHAR(16) NOT NULL,
    -> TYPE CHAR(4) DEFAULT 'FORE' NOT NULL
    -> CHECK ( TYPE = 'FORE'),
    -> currency_TYPE CHAR(3) NOT NULL
    -> CHECK ( currency_TYPE IN ('EUR','USD','HKD')),
    -> balance DECIMAL(16,2),
    -> PRIMARY KEY(account_no, foreign_id),
    -> FOREIGN KEY(account_no, TYPE)
    -> ON UPDATE CASCADE
    -> ON DELETE CASCADE);

the error message informs me that between foreign( account_no VARCHAR(16) NOT NULL, foreign_id VARCHAR(16) NOT NULL, TYPE gets wrong syntax, but I can’t find it, is there anything wrong?

  • 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-06-15T04:38:25+00:00Added an answer on June 15, 2026 at 4:38 am

    For FOREIGN KEY(account_no, TYPE) you need to give Reference columns

    Example

    CREATE TABLE parent (id INT NOT NULL,
                     PRIMARY KEY (id)
      ) 
     CREATE TABLE child (id INT, parent_id INT,
                    INDEX par_ind (parent_id),
                    FOREIGN KEY (parent_id) REFERENCES parent(id)
                      ON DELETE CASCADE
       ) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to AFNetworking but so far liking the abstraction. I'm creating a subclass
I am creating a subclass of QAbstractItemModel to be displayed in an QTreeView .
Creating a class at runtime is done as follows: klass = Class.new superclass, &block
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
Creating a simple RPG game, first time using XNA. Trying to get my character
Error creating bean with name 'sessionFactory' defined in class path resource [ApplicationContext.xml]: Invocation of
I'm creating a new subclass of UITableViewController, and with it the below default implementation.
I am creating a subclass to LuminanceSource . Is there a reason why I
Suppose I am creating a subclass of UITextView named for example, myTextView. I will
I am creating a subclass of UIBarButtonItem, to provide some specific functionality. The new

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.