Create Table Foreign Key Toad

Create Table Foreign Key Toad

Creating table with primary is straight forward if you are using Toad but adding foreign key constraint little tricky. Please have steps below:

  • Open your Toad and connect to the whatever database you are using then go to table tab and click create table button as below:

Create Table Foreign Key Toad

  • This will open crate table window please add columns, table name, set column for private key then click Show script button as shown below:

Create Table Foreign Key Toad

  • This will show you final execute create table script, click Execute button to execute script to create table you will see table got created. (If still don’t see new table then click F5 button on key board to refresh object explorer window:

 

Create Table Foreign Key Toad

  • Now create another table which will have reference column as foreign key. Please provide table name, add columns, set primary key then click Constraints as below:

Create Table Foreign Key Toad

  • Once you click constraints it will open below window here you will have to provide constraint type, constraint Name, Reference database, Reference table, Source Columns, Reference Columns as shown in below then click Show script:

Create Table Foreign Key Toad

  • Show script button will show you final create table script as below, click Execute to create table:

Create Table Foreign Key Toad

  • Now you should be able to see both the table if still don’t see it press F5 button on your key board to refresh object explorer window you will both table as below:

Create Table Foreign Key Toad

  • That’s it now both the table are connected with foreign key constraints and if you want to see relationship between then just double click any of these table and click Relationship table as below:

Create Table Foreign Key Toad

  • Now its ready to use. For more information please visit Toad official documentation here

Leave a Reply

Your email address will not be published. Required fields are marked *