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.
Query
SQL
SELECT
cu.customer_id AS ID,
cu.first_name||' '||cu.last_name AS name,
a.address AS address,
a.postal_code AS "zip code",
a.phone AS phone,
city.city AS city,
country.country AS country,
case when cu.active=1 then 'active' else '' end AS notes,
cu.store_id AS SID
FROM
customer AS cu
JOIN
address AS a ON cu.address_id = a.address_id
JOIN
city ON a.city_id = city.city_id
JOIN
country ON city.country_id = country.country_id
Columns
This view contains 9 columns.
ID
NAME
ADDRESS
zip code
PHONE
CITY
COUNTRY
NOTES
SID