Patent ID: 7908266

Claim:
A computer implemented method for automatically creating an SQL join expression, comprising: receiving a first user input that identifies a first table to be included in the SQL join expression; receiving a second user input that identifies a second table to be included in the SQL join expression; automatically creating a first SQL join for the SQL join expression and adding the first table to a left side of the first SQL join and adding the second table to a right side of the first SQL join; automatically matching one or more keys or indices in the first table with one or more keys or indices in the second table to define a where clause for the SQL join expression, said automatically matching including: searching metadata associated with columns of the first table to identify a unique key column; searching metadata associated with columns of the second table to identify a foreign key column that matches a column name and data type of the unique key column in the first table; and defining the where clause for the SQL join expression based on the unique key column and the foreign key column when a match is found, wherein the metadata used in defining the where clause is accessed from a different server than a database server containing the first table and the second table; and storing the SQL join expression in a memory device.