Joining Tables Automatically

When you add two or more tables to a query, the dbForge Studio attempts to determine whether they are related. If they are, the dbForge Studio automatically adds join lines between the rectangles representing the tables or table-structured objects.

dbForge Studio recognizes tables as joined in the following cases:

  1. The database contains information that specifies that the tables are related.
  2. If two columns, one in each table, have the same name and data type. The column must be a primary key in at least one of the tables. For example, if you add person and password tables, if the password_id column is the primary key in the password table, and if each table has a column called password_id with the same data type, the dbForge Studio will automatically join the tables.

  3. dbForge Studio detects that a search condition (e.g. the WHERE clause) is actually a join condition. For example, you might add the tables person and password, then create a search condition that searches for the same value in the password_id column of both tables. When you do, dbForge Studio detects that the search condition results in a join, and then creates a join condition based on the search condition.

If the dbForge Studio has created a join that is not suitable to your query, you can modify the join or remove it. If the tool does not automatically join the tables in your query, you can create a join yourself.

Note
dbForge Studio will create only one join based on columns with the same name and data type. If more than one join is possible, the dbForge Studio stops after creating a join based on the first set of matching columns that it finds.