Address

The Address table is designed to store address information for users and brands. It includes columns for the street address, city, state or province, country, and postal code, as well as flags to indicate whether the address is the default for a user or brand. The table also tracks the user who created or last modified the address, along with the corresponding date and time.

Table Structure
  • [ID] (bigint, auto-incrementing, primary key): Represents the unique identifier for each address record.

  • [Brand_ID] (bigint, not null): Represents the brand associated with the address.

  • [User_ID] (bigint, nullable): Represents the user associated with the address, if applicable.

  • [Address] (nvarchar(500), nullable): Represents the street address.

  • [City_ID] (bigint, not null): Represents the city associated with the address.

  • [State_ID] (bigint, nullable): Represents the state or province associated with the address, if applicable.

  • [Country_ID] (bigint, not null): Represents the country associated with the address.

  • [Postal_Code] (varchar(20), nullable): Represents the postal or ZIP code of the address.

  • [Is_Default] (bit, not null): Indicates whether the address is the default address for the user or brand.

  • [Modified_By] (bigint, nullable): Represents the user who last modified the address.

  • [Modified_Date] (datetime, not null): Represents the date and time when the address was last modified.

  • [Created_By] (bigint, nullable): Represents the user who created the address.

  • [Created_Date] (datetime, not null): Represents the date and time when the address was created.

Constraints
  • [PK_Address]: primary key constraint on the [ID] column.

  • [DF_Address_IsDefault]: default constraint on the [Is_Default] column with a default value of 0.

  • [DF_UserAddress_ModifiedDate]: default constraint on the [Modified_Date] column with the current UTC date and time as the default value.

  • [DF_UserAddress_CreatedDate]: default constraint on the [Created_Date] column with the current UTC date and time as the default value.

Example Data

ID
Brand_ID
User_ID
Address
City_ID
State_ID
Country_ID
Postal_Code
Is_Default

1

1

NULL

123 Main St

1

1

1

12345

1

2

NULL

1

456 Elm St

2

2

1

67890

0

3

NULL

1

789 Oak St

3

3

1

13579

1

Last updated

Was this helpful?