0

I have a database contains

  1. sholarships table for the scholarships,
  2. scholarshipstopicstable for the topics
  3. scholarship_topic for linking sholarships with topics

the scholarship_topic was contains UNIQUE columns that I dont need it so I deleted the INDEXES

after that the table delete it self

I recreated it with this order:

CREATE TABLE scholarship_topic ( 
    `id` INT(11) NULL PRIMARY KEY AUTO_INCREMENT, 
    `post_id` INT(11) NULL , 
    `topic_id` INT(11) NULL
) ENGINE = InnoDB;

NOTE : I dont have foreign key in the order the erorr:

#1005 - Can't create table scholarship_topic (errno: 150 "Foreign key constraint is incorrectly formed") (Details…)

I dont have a foriegn key, is it possible ?

Eymen
  • 27
  • 5
  • 3
    This is clearly not SQL Server code. Only tag with the database you are really using. Your sample code also has no foreign key definition, so it cannot generate the specified error. – Gordon Linoff Feb 13 '21 at 12:57
  • Since two out of three table definitions are missing in your question, one can only speculate here. Inspect your current schema state and run `SHOW ENGINE INNODB STATUS`. Take a look at the docs: https://mariadb.org/mariadb-innodb-foreign-key-constraint-errors/ – Mike Feustel Feb 13 '21 at 17:47
  • You might like this checklist of foreign key requirements: https://stackoverflow.com/a/4673775/20860 – Bill Karwin Feb 14 '21 at 00:37

0 Answers0