Altova DatabaseSpy 2023 Enterprise Edition

Adding Foreign Keys via SQL Scripts

Home Prev Top Next

To speed up the creation of the remaining foreign key relationships for the zoo database, an SQL script is provided. This script has already been added to the project earlier in this tutorial.

 

1.Open the "ZooDB" project created previously and double-click the dbs_ic_connected ZooDBConnect data source to connect to it.

2.In the Project window, double-click the file create_ZooDB_relationships.sql. Notice that the top of the SQL Editor displays the data source and the database against which the script is to be executed (ZooDBConnect.ZooDB). For more information, see Execution Target Bar.

dbs_zoo_foreign_key_02

3.Click the Execute ic_execute-sql button or press F5. Foreign key relationships are created between the tables in the zoo database.

 

To get a graphical view of the relationships that were just created, right click the "User Tables" folder in the Online Browser, and select Show in new Design Editor.

© 2017-2023 Altova GmbH