Skip to main content

Why I cannot successfully create the foreign keys

Why I cannot successfully create the foreign keys


From Navicat Wiki

Jump to: navigation, search
Apply OS : Windows, Mac, Linux
Apply Navicat Product : Navicat for MySQL, Navicat for PostgreSQL, Navicat for SQLite, Navicat for Oracle, Navicat Premium
Apply Navicat Version No. : All

 

MySQL

If you recevie MySQL Error likes 1005: Cant create table .mydb#sql-44c_1c.frm(errno: 150), it is caused by failure on creating Foreign Keys. There are some possible cases that might cause failure on creating Foreign Keys on MySQL database. These errors are related to MySQL itself.

Example cases :
  1. If the two fields (Field name and the Foreign Field name) are using incompatible field type.
  2. If you use "On Delete Set Null" but the field doesnt allow null.

To declare foreign keys in MySQL, there are few points which user should bear in mind :
  1. Both tables must be InnoDB type.
  2. In the referenced table, there must be an index where the referenced columns are listed as the first columns in the same order.
  3. Index prefixes on foreign key columns are not supported.
  4. InnoDB needs indexes on foreign keys and referenced keys so that foreign key checks can be fast and not require a table scan.
  5. The two key fields must have the compatible field type.
  6. The size and the sign of integer types has to be the same.
  7. The length of string types need not be the same.
  8. The foreign key name must be unique within the database
  9. If you specify a SET NULL action, make sure that you have not declared the columns in the child table as NOT NULL.

For more details on Foreign Key Constraints, please visit - http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html


PostgreSQL

If you recevie PostgreSQL Error likes ERROR: there is no unique constraint matching given keys for referenced table "xxxx", it is caused by failure on creating Foreign Keys.

To declare foreign keys in PGSQL, there are few points which user should bear in mind :
  1. A FOREIGN KEY constraint must refer to a PRIMARY KEY or UNIQUE constraint.
  2. The two key fields must have the compatible data type.
  3. Must have REFERENCES privilege on both the referencing and referenced tables.


Oracle

To declare foreign keys in Oracle, there are few points which user should bear in mind :
  1. A FOREIGN KEY constraint must refer to a PRIMARY KEY or UNIQUE constraint.
  2. The two key fields must have the compatible data type.
  3. Composite foreign keys are limited to 32 columns.
  4. Must have privileged access to the parent and child tables.

For more details on Foreign Key Constraints, please visit - http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10795/adfns_co.htm#1006976


SQLite

To declare foreign keys in SQLite, there are few points which user should bear in mind :
  1. The parent and child keys must have the same cardinality

For more details on Foreign Key Constraints, please visit - http://www.sqlite.org/foreignkeys.html

source : http://wiki.navicat.com/wiki/index.php/Why_I_cannot_successfully_create_the_foreign_keys%3F


download file now

download
alternative link download

Popular posts from this blog

Mini Militia ReAL DuAL WiELD MOD 3 06 by ARSHAD

Mini Militia ReAL DuAL WiELD MOD 3 06 by ARSHAD Most of my friends and sites visitors request me to create a Dual Wield MOD + Pro pack... I DONE IT......... Features:- � Propack Unlocked � Unlimited Ammo OR Bullets � ReAL DuAL WiELD MOD ( Bugs fixed now its working) � No Reload � One shot Kill ( 4 Bullets per shot ) � Unlimited Boost � Unlimited Bombs � No one can see u in Solo Play Mod Screenshots:- Click below for Download Use Chrome or other default browser for download this mod Dont Use Uc Mini Wait 5 seconds and Skip ad download  file  now

Mini Militia MEGA MOD 3 0 27 by Arshad KMODS

Mini Militia MEGA MOD 3 0 27 by Arshad KMODS New MEGA MOD 3.0.27... � 4X Time To Refill Health :- ?If You Injured by Gun/Bomb Then Your Life Refill/Recharge In 4X. � Die Only By Guns:- ?Bombs Will Not Harm For You. � High Range Of Bullets:- ?All Guns Rage Is Increased. � Sniper Zoom:- ?All Weapons Have 7X Zoom. � Laser Sight:- ?All Weapons Have Laser Sight. � Dual Wield MOD:- ?Now You Can Take Any Weapon As Dual Weapon , Like Taking Rocket Launcher With Sniper Or Double Barrel With A Fire Sprayer Or With Same Weapons (Example :- AK47 With Another AK47) Too. ?Sometimes It Will Freeze The Game While Playing In Quick Play MOD. � Unlimited Flying Power :- ?Unlimited Boost. � Disabled Gravity :- ?You Will Float On Air Like Lunacy. � One Shot Mega MOD:- ?9 Bullets PerShot. � Unlimited Ammo Or Bullets :- ?Your Guns Will Get Unlimited Number Of Bullets. ?Now You Can Switch Weapons And Throw Grenades. ?You Want Freezes Or Crashes In Quick Play Or Online MOD. ?The Zero Ammo In Lan-Wifi MOD Is Al...

Mini Militia IRON MAN MOD

Mini Militia IRON MAN MOD Download Mini Militia IRON MAN MOD Features :- � Pro pack Unlock � Unlimited Boost � Unlimited Bomb � One shot death (4 bullets per shot) � Unlimited Ammo or Bullets � No Reload � No one can see u in Solo Play mod � HD backgrounds � Modded Guns � New Music � You Can see other players life � In multiplayer mod you get Commander in Chiefs Batch � Different IRON MAN suitwith different colors combination � Blue bars are now green � Invisible Avatar ( only work if you chose invisible avatar ) Click below for download Wait 5 seconds and Skip AD Note:-       If any one not find Iron Man Avatars pls read this.. If any one not find do this steps 1) Open Mini Militias this mod 2) Go to Setting 3) Chose Configure (  3rd Option ) 4) Now OFF HI-RES GFX ( 4th Option ) 5) Restart Game 6) Done!!! Enjoy Mini Militia Iron Man MOD!!!!!!! Screenshots?? Share maximum......?????????????? download  file  now