Addresses table
The addresses table contains the billing and shipping addresses of customers. You can join this table with the sales table to generate lists of the billing and shipping addresses. Customers can enter their addresses more than once, so the same address can appear in more than one row in this table. This table contains one row per customer address.
Column | Data type | Description |
---|---|---|
address_id | numeric | The unique identifier for the address. This column is the primary key for the addresses table. |
shop_id | numeric | The ID of the store. This column is a foreign key reference to the shop_id column in the shops table. |
first_name | varchar | First name of the customer. |
last_name | varchar | Last name of the customer. |
address1 | varchar | The first address line. For example, 150 Elgin St. |
address2 | varchar | The second address line. For example, Suite 800. |
company | varchar | The name of the customer's business, if one exists. |
city | varchar | The name of the city. For example, Ottawa. |
region | varchar | The name of the region, such as a province or state, where the customer is located. For example, Ontario or New York. This column is the same as CustomerAddress.province in the Admin API. |
zip | varchar | The ZIP or postal code. For example, 90210. |
country | varchar | The full name of the country. For example, Canada. |
phone | varchar | The phone number of the customer. |
The following SQL query returns total sales by shipping and billing countries: