如何编写查询以查找所有客户名称及其地址是否有地址?
CREATE TABLE test.address
(
id integer NOT NULL,
street text,
city text,
CONSTRAINT address_pkey PRIMARY KEY (id)
)
CREATE TABLE test.customer
(
id integer NOT NULL,
name text,
CONSTRAINT customer_pkey PRIMARY KEY (id)
)
CREATE TABLE test.customer_addresses
(
id integer,
customer_id integer,
address_id integer,
CONSTRAINT customer_addresses_address_id_fkey FOREIGN KEY (address_id)
REFERENCES test.address (id),
CONSTRAINT customer_addresses_customer_id_fkey FORE IGN KEY (customer_id)
REFERENCES test.customer (id)
)