Error code: 1064

Source: Internet
Author: User

1. Error description

1 queries executed, 0 success, 1 errors, 0 warnings query: CREATE TABLE Example3 (ID Primary key, stu_id int, constraint C_FK f Oreign Key (stu_id,course_id) references example2 (Stu_id,cour ... Error code: 1064You has an error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use near ' Primary key,      stu_id I NT,      constraint C_FK foreign key (Stu_id,course_i ' at line 2 time elapsed   : 0 sec Delivery   : 0 sec total Elapsed      : 0 sec

2. Cause of error

CREATE TABLE example1 (      stu_id INT PRIMARY KEY,      stu_name VARCHAR (),      stu_sex BOOLEAN      );  CREATE TABLE example2 (      stu_id int,      course_id int,      grade FLOAT,      PRIMARY KEY (stu_id,course_id)      );      CREATE TABLE example3 (      ID PRIMARY key,      stu_id INT,      CONSTRAINT c_fk FOREIGN key (stu_id,course_id)      REFERENCES example2 (stu_id,course_id)      );      

The ID data type is not given when you create a new Example3 table


3. Solutions

CREATE TABLE example3 (      ID int PRIMARY key,      stu_id int,      CONSTRAINT c_fk FOREIGN key (stu_id,course_id)      REFERENCES example2 (stu_id,course_id)      );

1 queries executed, 0 success, 1 errors, 0 warnings query: CREATE TABLE example3 (id int Primary key, stu_id int, constraint c_ FK foreign Key (stu_id,course_id) references example2 (stu_id,... Error code: 1072Key column ' course_id ' doesn ' t exist in table execution   time: 0 sec Transmission Duration   : 0 sec Total Time      : 0.001 sec


Error code: 1064

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.