View customer_list
This view provides a list of customers, with first name and last name concatenated together and address information combined into a single view. The view incorporates data from the customer, address, city, and country tables.
Schema
This view belongs to schema sakila.
Query
SQL
SELECT cu.customer_id AS id,
concat((cu.first_name)::text, ' '::text, (cu.last_name)::text) AS name,
a.address,
a.postal_code AS "zip code",
a.phone,
city.city,
country.country,
CASE
WHEN cu.active THEN 'active'::text
ELSE ''::text
END AS notes,
cu.store_id AS sid
FROM (((sakila.customer cu
JOIN sakila.address a ON ((cu.address_id = a.address_id)))
JOIN sakila.city ON ((a.city_id = city.city_id)))
JOIN sakila.country ON ((city.country_id = country.country_id)));
Columns
This view contains 9 columns.
id
name
address
zip code
phone
city
country
notes
sid