Execute a SQL Query with Join Command

The following single-Snap Pipeline runs an SQL query containing a JOIN command to collate data between two PostgreSQL tables.


PostgreSQL Execute Pipeline

Download this pipeline.
  1. Consider the following tables in a PostgreSQL DB
    Note: Notice that the column employee_id is common between these tables.
    Employees Emp salary

    employees-table

    employee-salary
  2. Cofigure the PostgreSQL Execute Snap with a SQL query to access the tables using a JOIN command:
    example2-postgresql-execute-config
  3. On validation, the Snaps displays the result for the SQL query as shown below.
    postgresql-execute-output

    Upon joining the two tables as defined in the SQL query, we can see the

    employee_id column in the second table is prefixed with its table name AVempsalary to differentiate it from the column with the same name in the AVemployees table.

    This is how the PostgreSQL Execute Snap handles column with conflicting names in tables when the SQL statement contains a JOIN command.