alter table stu add foreign key(cno) references user(id);
Failed to add the foreign key constraint. Missing index for constraint ‘stu_ibfk_1’ in the referenced table ‘user’
solution:
as the foreign key, user table id must be a unique value, so the constraint unique, or primary key must be added;
Read More:
- 1822 – Failed to add the foreign key constraint. Missing index for constraint ‘tb_emp_ibfk_1’ in the
- MySQL failed to add foreign key: SQL 1452 cannot add or update a child row:a foreign key constraint fails
- Mysql error 1452 – Cannot add or update a child row: a foreign key constraint fails
- Solution to error 1452: cannot add or update a child row: a foreign key constraint failures in MySQL
- MySql ERROR CODE:1215 Cannot add the foreign key constraint
- Ora-02292: integrity constraint (XX) violated – child record found foreign key Association, record cannot be deleted
- MySQL failed to add foreign key error 1452
- MYSQL ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
- Mysql error when deleting the table structure: Error Code: 1217. Cannot delete or update a parent row: a foreign key constraint fails
- [Oracle] when inserting data, “ora-00001: unique constraint” appears
- python sqlite Error IntegrityError: UNIQUE constraint failed: table_area1.user_name
- MySQL error 1451 23000 foreign key exception handling
- django.db.utils .IntegrityError: NOT NULL constraint failed: blog_ blog.author_ ID error resolution
- django.db.utils.IntegrityError: UNIQUE constraint failed: auth_user.username
- MySQL:Foreign key fails with error Error Code: 1452.
- IntegrityError at ** NOT NULL constraint failed: learning_logs_topic.owner_id
- greendao insert data UNIQUE constraint failed: PURCHASE_ORDER_TABLE._id (code 1555)
- MySQL error code 1217 (ER_ROW_IS_REFERENCED): Cannot delete or update a parent row: a foreign key co
- Error report of. XML header file constraint in idea
- Android project error: could not resolve com.android.support .c onstraint:constraint-layout :2.0.2.