![]() ![]() When I click for Details, here's what I see: Here's the error I'm getting from phpMyAdmin: MySQL said: Documentationġ005 - Can't create table commune.writing (errno: 150 "Foreign key constraint is incorrectly formed") (Details…) I was following an example in a book and changed a few things. GRANT ALL ON commune.* TO TABLE IF NOT EXISTS users (īirth_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, CREATE DATABASE IF NOT EXISTS commune ĬREATE USER IF NOT EXISTS IDENTIFIED BY 'password' I read the MySQL 8.0 reference manual but I can't seen to find the error. The users table is created but the writing table has an error: Foreign Key Constraint is incorrectly formed. I'm trying to create a database through phpMyAdmin by importing a SQL file. Thanks to -sniff- for the awesome header image! You should post these to /r/learnsql instead. Note /r/SQL does not allow links to basic tutorials to be posted here. Please view the Wiki for online resources. Learning SQLĪ common question is how to learn SQL. SELECT count(a.field1), a.field2, SUM(b.field4) FROM a INNER JOIN b ON a.key1 = b.key1 WHERE a.field8 = 'test' GROUP by a.field1, a.field2 HAVING SUM(b.field4) > 5 ORDER by a.field.3įor those with SQL questions we recommend using SQLFiddle to provide a useful development and testing environment for those who wish to fully understand your problem and help devise a solution. Something as simple as line breaks and using reddit's built in code formatting (4 spaces at the start of each line) can turn this: This will greatly increase your chances of receiving the help you desire. If you are including actual code in a post or comment, please attempt to format it in a way that is readable for other users. We will gladly help where we can as long as you post the work you have already done or show that you have attempted to figure it out on your own. If you are a student or just looking for help on your code please do not just post your questions and expect the community to do all the work for you. While naturally we should endeavor to work as platform neutrally as possible many questions and answers require tailoring to the feature set of a specific platform. ![]() When requesting help or asking questions please prefix your title with the SQL variant/platform you are using within square brackets like so: `#sql-15d0_4c5_ibfk_1` FOREIGN KEY (`department_fk`) REFERENCESĪLTER TABLE departments ADD FOREIGN KEY (company_fk ) REFERENCES companies (company_id ) ON DELETE CASCADE ON UPDATE CASCADE įails (`advanced_yii2`.The goal of /r/SQL is to provide a place for interesting and informative SQL content and discussions. `#sql-15d0_4c5_ibfk_1` FOREIGN KEY (`company_fk`) REFERENCES `companies`ĪLTER TABLE branches ADD FOREIGN KEY (department_fk ) REFERENCES departments (department_id ) ON DELETE RESTRICT ON UPDATE RESTRICT MySQL a répondu: #1452 - Cannot add or update a child row: a foreign key constraintįails (`advanced_yii2`.`#sql-15d0_4c5`, CONSTRAINT `department_status` enum('active','inactive') NOT NULL,ĪLTER TABLE branches ADD FOREIGN KEY (company_fk ) REFERENCES companies (company_id ) ON DELETE RESTRICT ON UPDATE CASCADE `company_status` enum('active','inactive') NOT NULL `company_id` int(11) NOT NULL DEFAULT '0', `branch_status` enum('active','inactive') NOT NULL I have a probleme with creation foreight key in phpmy admin so, i join my database and sql qource witch i use it,ĪLTER TABLE departments ADD CONSTRAINT contrainte_fk FOREIGN KEY (company_fk) REFERENCES companies(company_id) ON DELETE CASCADE ON UPDATE CASCADE CREATE TABLE `branches` ( This edit will be visible only to you until it is peer reviewed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |