CREATE TABLE invoices_archieved AS
INSERT INTO invoices_archieved
Where payment_date IS NOT NULL;
FROM invoices_archieved I
JOIN clients C
ON C.name = I.client_id
Is this code is correct for the example? When i run this code no error but the Join operator didn’t worked, not replacing name with client id.
It didn’t work because you are joining on
id never have matching values the result will be empty.
And you will want to revisit the excercise. We didn’t want the
invoices_archived table to be a 1:1 copy of the
invoices table. We wanted to have a
name column with the clients name in
invoices_archived instead of the original
client_id column of the
invoices table.emphasized text