About 87,300 results
Open links in new tab
  1. mysql - Add Foreign Key to existing table - Stack Overflow

    I want to add a Foreign Key to a table called "katalog". ALTER TABLE katalog ADD CONSTRAINT `fk_katalog_sprache` FOREIGN KEY (`Sprache`) REFERENCES `Sprache` (`ID`) ON DELETE SET …

  2. sql - Foreign keys in MySQL? - Stack Overflow

    The foreign key column isn't exactly the same data type as the primary key column in the referenced table Unfortunately, MySQL gives no message that it has failed to create the foreign key constraint. It …

  3. How to remove constraints from my MySQL table? - Stack Overflow

    Jan 2, 2013 · As of MySQL 8.0.19, ALTER TABLE permits more general (and SQL standard) syntax for dropping and altering existing constraints of any type, where the constraint type is determined from …

  4. How can I add a foreign key when creating a new table?

    Oct 27, 2008 · From the MySQL Reference: For storage engines other than InnoDB, MySQL Server parses the FOREIGN KEY syntax in CREATE TABLE statements, but does not use or store it.

  5. Multiple-column foreign key in MySQL? - Stack Overflow

    Apr 6, 2016 · Use of the constraint syntax enables you to name a constraint, making it easier to alter and drop at a later time if needed. InnoDB enforces foreign keys, MyISAM does not.

  6. MySQL Syntax in creating Foreign Key - Stack Overflow

    Is this syntax correct in creating a Foreign Key? create table department ( departmentID int not null auto_increment primary key, name varchar(30) ) type=InnoDB; create table employee (

  7. sql - How to add a column and make it a foreign key in single MySQL ...

    In mysql, can I add a column and foreign key in the same statement? And what is the proper syntax for adding the fk? Here is my SQL: ALTER TABLE database.table ADD COLUMN columnname INT …

  8. mysql - Foreign Key Syntax - Stack Overflow

    Nov 29, 2015 · mysql database database-design edited Mar 6, 2013 at 14:27 echo_Me 37.2k 5 62 81

  9. Why am I getting MySQL error 1064 on foreign key constraint?

    Apr 27, 2016 · I do have the JOB_CODE column in the Job Table. Does it need to be set as foreign key in the Job Table first before the query can run? I am not fully following you. you need to add the …

  10. mysql - ERROR 1064 (42000): You have an error in your SQL syntax ...

    Nov 2, 2025 · ERROR 1064 (42000): 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 'FOREIGN KEY …