I have information about customers stored in a table. each row has an account_id that is a foreign key to a table called accounts. how can you select the postcode
column from the address table for a customer with ID 123?
SELECT `postcode` FROM `accounts` AS `a` JOIN `customers` as `c` ON `c.account_id` = `a`.`id` Where `c`.id = 123
Correct:
SELECT `postcode` FROM `accounts` AS `a` JOIN `customers` as `c` ON `c.account_id` = `a`.`id` Where `c`.id = 123
Explanation:
SELECT postcode FROM accounts AS a
JOIN customers as c ON c.account_id = a.id
WHERE c.id = 123