I have to do a SQL query on several tables.
I need to relate the two through a common "id" but I do not know how I do not have declared primary keys or foreign keys.
Follow the code snippet:
SELECT a.iban, TO_CHAR(date_, 'month ,yyyy-dd') AS "Opening date", o.client_id AS "Client NR.", op.status
FROM operation o JOIN open_operation op ON o.id_op = op.id
JOIN account a ON o.account_id = a.id
JOIN client c ON o.client_id = c.id
The following information needs to be included in the previous query:
SELECT y.name
FROM agency y JOIN account a ON y.id = a.agency_id