customer_list
Documentation | Sakila |
Name | customer_list |
Module | Views |
The customer_list view provides a list of customers, with first name and last name concatenated together and address information combined into a single view.
The customer_list view incorporates data from the customer, address, city, and country tables.
Columns
Key | Name | Data type | Null | Attributes | References | Description | ||
---|---|---|---|---|---|---|---|---|
1 | ID | unsigned smallint(5, 0) | Default: 0 | The customer ID. | ||||
The customer ID. Default: 0 |
||||||||
2 | name | varchar(91) | The customer's full name. | |||||
The customer's full name. |
||||||||
3 | address | varchar(50) | The customer's address | |||||
The customer's address |
||||||||
4 | zip code | varchar(10) | The postal code or ZIP code of the address. | |||||
The postal code or ZIP code of the address. |
||||||||
5 | phone | varchar(20) | The telephone number for the address. | |||||
The telephone number for the address. |
||||||||
6 | city | varchar(50) | Name of the city. | |||||
Name of the city. |
||||||||
7 | country | varchar(50) | The name of the country. | |||||
The name of the country. |
||||||||
8 | notes | varchar(6) | Indicates whether the customer is an active customer. | |||||
Indicates whether the customer is an active customer. |
||||||||
9 | SID | unsigned tinyint(3, 0) | The ID of customer's “home store.” | |||||
The ID of customer's “home store.” |
Script
select `cu`.`customer_id` AS `ID`,concat(`cu`.`first_name`,' ',`cu`.`last_name`) AS `name`,`a`.`address` AS `address`,`a`.`postal_code` AS `zip code`,`a`.`phone` AS `phone`,`sakila`.`city`.`city` AS `city`,`sakila`.`country`.`country` AS `country`,if(`cu`.`active`,'active','') 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` = `sakila`.`city`.`city_id`))) join `sakila`.`country` on((`sakila`.`city`.`country_id` = `sakila`.`country`.`country_id`))) |
Exported: 2018-10-12 17:43, Last imported: 2018-08-06 10:44